Microsoft Drivers 3.0 for PHP for SQL Server Released to Web!

Dear SQL Server Developer Community,

We wanted to extend a massive ‘thank you’ to the community in providing feedback for our release of our Customer Technology Preview back in September, and we’ve been working hard to incorporate the feedback you have provided us. You will find that we’ve fixed many issues you reported, and we are proud to be able to release the final build of our 3.0 drivers.

The major highlights of this release include: support for SQL Server 2012 features, and Buffered Queries. The 2012 features include support for AlwaysOn Connectivity, encompassing support for Multi-Subnet Failover, connectivity to AlwaysOn Availability Groups and Read-Only Routing, and support for SQL Express LocalDB.

SQL Server 2012: LocalDB

The Microsoft Drivers for PHP for SQL Server include support for SQL Express LocalDB, a new distribution of SQL Server. LocalDB is a lightweight install, providing only the database engine. This engine is brought up automatically when an application connects to the instance, and provides easy connection-time parameters for attaching file-based databases. This feature significantly simplifies the development experience, as well as reducing the installation components necessary to develop for SQL Server. Enabling support for LocalDB is as easy as changing the connection string. An example in the SQLSRV driver:

$serverName = "(localdb)\v11.0";
$connectionOptions = array( "Database"=>"AdventureWorks", “AttachDBFileName”=>”AdventureWorks.mdf” );
/* Connect to SQL Express LocalDB. */
$conn = sqlsrv_connect( $serverName, $connectionOptions );

And an example in the PDO_SQLSRV driver:

$conn = new PDO("sqlsrv:Server=(localdb)\v11.0 ; Database = AdventureWorks ; AttachDBFilename = AdventureWorks.mdf", "", "");

All functionality expected from a standard SQL Server Express instance will also function with LocalDB, as well as all standard driver functions. Additionally, databases attached at connection time will automatically be attached in the engine if they are not already, or redirected to the existing attached file if the engine already has it attached.

SQL Server 2012: AlwaysOn Connectivity

The Microsoft Drivers for PHP for SQL Server include support for the AlwaysOn Connectivity feature of SQL Server 2012:
SQL Server AlwaysOn is the new high availability and disaster recovery solution for the next release of SQL Server. Using AlwaysOn businesses can achieve increased application availability for their mission critical applications and get higher returns on their high availability investments through better utilization of hardware resources. AlwaysOn also increases productivity and lowers TCO by greatly simplifying high availability deployment and management.

The driver now supports the two new connection options “ApplicationIntent” and “MultiSubnetFailover” to support AlwaysOn connectivity.

Buffered Queries

Finally, the driver now provides support for resultsets to be buffered on the client-side by the driver. This feature is very common amongst PHP database drivers and we are proud to bring support for this in our 3.0 release. This is an opt-in feature which caches the entire resultset from a query into memory, therefore reducing subsequent round-trips to the server usually required to fetch the resultset row-by-row. An example where Buffered Queries is enabled in the SQLSRV driver is presented below:

/* Get products by querying against the product name.*/
$tsql = "SELECT ProductID, Name, Color, Size, ListPrice FROM Production.Product";
/* Execute the query, buffered queries enabled */
$getProducts = sqlsrv_query( $conn, $tsql, null, array("Scrollable"=>"buffered")););

And also in the PDO_SQLSRV driver:

/* Get products by querying against the product name.*/
$tsql = "SELECT ProductID, Name, Color, Size, ListPrice FROM Production.Product";
/* Prepare and execute the query, buffered queries enabled */

Other features

We also added supported for the PDO Attribute PDO::ATTR_EMULATE_PREPARES, which can be of assistance when using parameters in a query that would not normally be supported by Transact-SQL.

Finally, we incorporated many fixes reported by our community and hope that you find an improved experience with this new release.

Documentation, Feedback and Download

You can find documentation on the driver at our MSDN documentation page, provide feedback on our MSDN Forum and at the SQL Server Connect Site, and (most importantly!) download the driver here. Also note that you will require the SQL Server 2012 Native Access Client, available as part of our SQL Server 2012 Feature Pack, viewable here.

UPDATE: I'm still bringing up the download page, so please be patient while it replicates through our distribution systems. I'll update this post once it's up and running. Thanks! --Jonathan

I’d like to thank everyone on behalf of the team for supporting us in our endeavors to provide you with a high-quality driver. Happy downloading!


Jonathan Guerin
Program Manager
SQL Connectivity
Microsoft Corporation


No Comments