Freigeben über


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:

<?php $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:

<?php `` $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:

<?php
/* 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:

<?php
/* 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 */
$stmt = $conn->prepare( $tsql, array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL, PDO::SQLSRV_ATTR_CURSOR_SCROLL_TYPE => PDO::SQLSRV_CURSOR_BUFFERED));
$stmt->execute();
?>

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. You can find the source code at our Codeplex Page.

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!

Thanks,

Jonathan Guerin
Program Manager
SQL Connectivity
Microsoft Corporation

Comments

  • Anonymous
    March 06, 2012
    The download page still shows 2.0.1 in the "Quick details" section, and when you download the actual file it appears to still be the 2.0 installer.

  • Anonymous
    March 06, 2012
    Hi Beau, I have updated the bottom of the blog post with the deep-link to the 3.0 driver. I'm fixing up the landing page right now. Thanks for pointing it out! Jonathan

  • Anonymous
    March 06, 2012
    Awesome! Thanks! Looking forward to testing them out and upgrading our systems!

  • Anonymous
    March 06, 2012
    Hi, Great job ! Now looking forward to a 5.4 version. Any migration is impossible without it. Bruno

  • Anonymous
    March 08, 2012
    Is it safe to upgrade a server that's running SQLSRV 1.1? There isn't any upgrade info I could find. P.S. "Sign In" does not work. For some reason it attempts to create a new account with your current credentials and obviously fails.

  • Anonymous
    March 08, 2012
    Alvaro, The API between 1.1 and 3.0 has remained compatible, so an upgrade between the drivers should work just fine. Cheers, Jonathan

  • Anonymous
    March 12, 2012
    Hi, Great work! Now all we need are PHP 5.4 compatible versions of this and the wincache plugin :)

  • Anonymous
    March 14, 2012
    Is 2.0 not available for download anymore? every 2.0 link I have found takes me to the 3.0 page and using it on a 2003 server doesn't work at all

  • Anonymous
    March 15, 2012
    Hi David, You can still find the 2.0 driver at the following location: download.microsoft.com/.../SQLSRV20.EXE Cheers, Jonathan

  • Anonymous
    April 25, 2012
    The comment has been removed

  • Anonymous
    April 25, 2012
    Hi Pablo, Can you please create a post on our forums so that we can more effectively help you? social.msdn.microsoft.com/.../threads Thanks, Jonathan