|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patchespdo_dblib.patch (last revision 2013-03-04 16:00 UTC by mah at everybody dot org)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-03-02 15:57 UTC] mah at everybody dot org
[2013-03-02 16:56 UTC] pajoye@php.net
[2013-03-02 16:56 UTC] pajoye@php.net
-Status: Open
+Status: Feedback
[2013-03-02 17:30 UTC] pajoye@php.net
[2013-03-02 19:36 UTC] mah at everybody dot org
[2013-03-02 19:36 UTC] mah at everybody dot org
-Status: Feedback
+Status: Open
[2013-03-04 16:05 UTC] mah at everybody dot org
[2013-06-01 05:58 UTC] ssufficool@php.net
[2013-06-01 05:58 UTC] ssufficool@php.net
-Status: Open
+Status: Closed
[2013-06-04 03:40 UTC] ssufficool@php.net
[2013-06-04 05:03 UTC] stas@php.net
[2013-06-11 16:48 UTC] mah at everybody dot org
[2013-10-06 01:27 UTC] ssufficool@php.net
[2013-11-17 09:30 UTC] laruence@php.net
[2013-11-17 09:31 UTC] laruence@php.net
[2013-11-17 09:31 UTC] laruence@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 20:00:01 2025 UTC |
Description: ------------ The SQL database available on Azure apparently does not have the same connection semantics as SQL Server. “use DATABASE” is not possible — it returns an error saying that you should open a new connection if you want a new database. This is confusing when you are using the DBLIB connector because it is the DBLIB connection code that does the “use”, not the developer's PHP code. The FreeTDS people recognized this a while back: About a year ago we added the DBSETLDBNAME macro as a way to set the dbname in the db-lib LOGINREC. That sets the dbname in the login packet, obviating the need for "USE dbname". http://lists.ibiblio.org/pipermail/freetds/2012q4/028168.html The attached patch makes use of DBSETLDBNAME and eliminates the USE. Test script: --------------- <?php try { $server = "SERVER.database.windows.net:1433"; $username = "USER@SERVER"; $password = "PASSWORD"; $dbname = "DBNAME"; $mssql = new PDO("dblib:host=$server;dbname=$dbname",$username,$password); echo "Success!\n"; } catch ( PDOException $e ) { print( "Error connecting to SQL Server." ); die(print_r($e)); }