Anybody know any php frameworks that supports full SQL server 2008 ??
I know Codeigniter supports mssql.
Not sure if you are looking for a framework specific connection to MS SQL server however PHP does have support for SQL server connections with mssql_connect();
mssql_connect()
As user644051 had already mentioned below - present driver to connect CI with MSSQL is SqlSrv.
I managed to connect CI with MS SQL 2008 and started to work with it.
BUT the way you have to twist your CI code to force database to cough up the results... is not worth the effort.
Bottom line: MSSQL driver is not optimized to work flowlessly with CI contrary to MYSQL which allows for easy and smooth work.
For example SqlSrv driver doesn't work for CI insert_batch().
Although I'd like to use flexibility that MSSQL server offers - at the moment we have to wait for a driver that will allow for such a luxury in CI.
So for the moment I discourage you to use CI with MSSQL.
Related
Our EMR software uses Advantage Database SQL server as its database and I'm creating various PHP projects which require interaction with this database.
What is the best approach to connecting and working with Advantage DB SQL and PHP? I'd like to connect on a read-only level to prevent any data wrong-doing with insurance/patient/provider records.
Note: I connect to other databases using PDO drivers. Is there an Advantage DB driver for PDO that I'm unaware of?
Server info:
PHP, Windows 2008, IIS 7
PHP PDO support is slated for release in v11.0 of Advantage later this summer. It is listed on our user voice feature request site here: PDO feature request.
You can view our PHP documentation online on our developer zone website here: PHP Documentation.
On the features page for the product, they list an ODBC connector under the "Servers & Clients" section.
It happens that PDO can speak ODBC. This is probably your best bet.
They also have a separate PHP extension, however they're hiding it being a registration wall and the documentation does not seem to be public. Whether it includes a PDO driver is not stated.
What is the preferred method of accessing a Microsoft SQL Server database with PHP 5.3+ on Linux?
Given the different extension options now available I'm unsure which method is preferred based on reliability and performance. Right now I am using the mssql extension with FreeTDS, but I'd like to know if this isn't the best way.
I've heard some recommend using php-odbc/EasySoft because the mssql extension has been abandoned - yet others have said going the ODBC route isn't worth the performance hit.
The response to this stackoverflow question seems to touch on what I'm asking, however it's Windows centric.
Thank you!
I've had good results using PHP's PDO (PHP Data Objects) library for this sort of thing. There's an excellent tutorial at http://net.tutsplus.com/tutorials/php/why-you-should-be-using-phps-pdo-for-database-access/. Just make sure you use the following template to initialize your database connection:
$dbh = new PDO("dblib:host=$host;dbname=$dbname", $user, $pass);
I use FreeTDS. It's far from satisfactory. In fact, I found your question because I live in hope that there must be a better solution and I keep looking for one. Unfortunately, FreeTDS seems to be the best option at the moment, if you're developing in a Linux environment.
If you were on Windows, you could obviously use the Microsoft SQL Server drivers for PHP which would be better, but even then there are missing features, like support for PDO lastInsertId().
This has probably been asked before but I can't find it anywhere.
I have just found out that the mssql extension has been dumped from php (I know it was a while ago I'm a bit slow).
I have a legacy app that is using it and all the mssql_query etc functions. I'm wondering what the suggested route is?
PDO?
Microsofts Driver
Move to another DB?
I'm not entirely averse to moving to mysql since everytime I have to move boxes I have huge issues getting MSSQL to work correctly with php. Is old mysql extension still supported or do I need to move to PDO anyway?
Is there an easy way to move to PDO? Any suggestions welcome.
PDO is recommended anyway to abstract to DB connections, so if you go to MySQL I'd highly recommend using it. If you're on windows environments connecting to SQL server then the MS SQLSRV library is likely a good route to take. I have used the odbc_* functions when dealing MSSQL in the past with no problems, including calling stored procs as well as my own queries.
Another DB which didn't have OS lock in would be a good move too though. MySQL is ubiquitous, however don't rule out alternatives without doing some research first.
I'm getting a new project some time now and wanted to use PHP for this one, as I don't have the time to get started with MVC and absolutely hate C# for Webdev.
So I was thinking of going "back to my roots" and use PHP and PDO for that. Problem is, the Databases are all SQL Server 2003 and I don't quite know how well that is covered in PDO.
Does anybody have experience with this or should I go on getting ASP.NET-MVC into my head (Which I will do anyways, but this project needs fast deployment...)
The most common problem when using PHP and MSSQL is using an old (faulty) driver. Also, have a read of the comments on the PHP MSSQL manual page.
I don't know that PDO supports MS SQL, however I have successfully used the ADODB abstraction layer against both MS SQL 2000 and 2008 without issues. Your mileage may vary...
Is it possible to connect PHP to a SQL Server Compact Edition database? What would be the best driver?
I need it for a desktop application where SQL Server Express is too heavy.
Short Answer : No.
Long Answer : To my knowledge, unlike PostgreSQL / MySQL / MS-SQL, there is no native driver to connect PHP to SQL Server Compact Edition.
If you want to connect to it, your best bet is to use PHP ODBC connections to talk to a ODBC Driver connected to the SQL Compact server. But its pretty much a hack, and you'd be crazy to use this kind of thing for anything remotely important.
If you are worried about SQL Server Express being too heavy, use MySQL with MyISAM tables. It's pretty fast and lightweight. Emergent has a good checklist of things to configure / disable to make MySQL even faster and use less resources.
Relevant links :
MSDN Post asking the same question
Erik EJ's blog - SQL Compact with OLE DB
You could also consider SQLite:
http://www.devshed.com/c/a/PHP/Introduction-to-Using-SQLite-with-PHP-5/
I've used the php-odbtp to interface PHP (with ADOdb) to a MS SQL server and it runs well, even across remote networks.
It provides a tunneling protocol from a non-odbc platform (Linux) to a service installed on the Win32 machine to buffer requests to and from an ODBC connection. Bit of a pain to setup the first time, at least 2-3 years ago when I first used it. Should also work fine for Win32<->Win32 applications.
Not familiar with SQL C.E., but I'd imagine it supports an ODBC connection of some sort, and the standard T-SQL commands.
I wrote a php class that handles SQL compact edition files using the COM object of PHP.
This means it will only work on Windows based machines where the SQL Compact Edition runtime is installed.
You can download here (article is in German, link is at the bottom) with an example database file and script
http://www.klemmkeil.de/sql-compact-edition-sdf-mit-php-auslesen/
The question is Why? Why not just use an Express Version?
I must say that I'm curious, but I can't say that I've used a C.E. data base for anything outside of a .Net application that had the assemblies in the application folder.