Edit report at https://bugs.php.net/bug.php?id=65219&edit=1
ID: 65219 Comment by: steven dot levin at sdepot dot com Reported by: f dot marquis at of2m dot fr Summary: PDO/dblib not working anymore ("use dbName" not sent) Status: Closed Type: Bug Package: PDO related Operating System: CentOS 6.4 PHP Version: 5.4.17 Assigned To: ssufficool Block user comment: N Private report: N New Comment: Hopefully I am missing something here but I am still experiencing this issue with: FreeBSD 9.1 PHP 5.4.20 Freetds msdblib 0.64 USE database never gets called and queries attempt to execute against the master database. freetds.log never shows use cmd Is there something I can do yo troubleshoot on my end? Previous Comments: ------------------------------------------------------------------------ [2013-07-15 00:07:34] s...@php.net Automatic comment on behalf of ssufficool Revision: http://git.php.net/?p=php-src.git;a=commit;h=d012bdca0319e225435430f89446828642b9810d Log: Fix Bug #65219 DBSETLDBNAME should be called before login to set DBNAME in login record ------------------------------------------------------------------------ [2013-07-14 18:18:24] ssuffic...@php.net Automatic comment on behalf of ssufficool Revision: http://git.php.net/?p=php-src.git;a=commit;h=d012bdca0319e225435430f89446828642b9810d Log: Fix Bug #65219 DBSETLDBNAME should be called before login to set DBNAME in login record ------------------------------------------------------------------------ [2013-07-08 13:37:43] f dot marquis at of2m dot fr Description: ------------ All queries to our MSSQL 2008 database (PDO_dblib with freeTDS) are failing since PHP 5.4.17 (same code) setting freeTDS into debug mode seems to indicate that the SQL queries are not sent to the correct database, but to 'master' database, so queried object are not found. FreeTDS log with PHP 5.4.17 : ... (dblib.c:239):dblib_add_connection(0x7f001af738e0, 0x7f002be94540) (dblib.c:4317):dbsetopt(0x7f002be93a00, 7, 2147483647, -1) (dblib.c:4432):UNIMPLEMENTED dbsetopt(option = 7) (dblib.c:4317):dbsetopt(0x7f002be93a00, 17, 2147483647, -1) (dblib.c:4432):UNIMPLEMENTED dbsetopt(option = 17) (dblib.c:4317):dbsetopt(0x7f002be93a00, 35, 1, -1) (dblib.c:761):dbsetlname(0x7f002be93850, Emploi, 14) (dblib.c:5762):dbsetuserdata(0x7f002be93a00, 0x7f002a851fa0) (dblib.c:3196):dbcancel(0x7f002be93a00) (query.c:2155):tds_send_cancel: not in_cancel and idle (dblib.c:1312):dbcmd(0x7f002be93a00, SELECT col FROM table WHERE id = 1 ) ... FreeTDS log with PHP 5.4.11 (working) : ... (dblib.c:239):dblib_add_connection(0x7fbc5d3d68e0, 0x7fbc6ec007f0) (dblib.c:4317):dbsetopt(0x7fbc6ebffe30, 7, 2147483647, -1) (dblib.c:4432):UNIMPLEMENTED dbsetopt(option = 7) (dblib.c:4317):dbsetopt(0x7fbc6ebffe30, 17, 2147483647, -1) (dblib.c:4432):UNIMPLEMENTED dbsetopt(option = 17) (dblib.c:4317):dbsetopt(0x7fbc6ebffe30, 35, (null), -1) (dblib.c:7929):dbperror(0x7fbc6ebffe30, 20176, 0) (dblib.c:7981):20176: "Called dbsetopt with parameter 3 NULL" (dblib.c:5780):dbgetuserdata(0x7fbc6ebffe30) (dblib.c:8002):"Called dbsetopt with parameter 3 NULL", client returns 2 (INT_CANCEL) (dblib.c:1398):dbuse(0x7fbc6ebffe30, Emploi) (dblib.c:1312):dbcmd(0x7fbc6ebffe30, use [Emploi]) (dblib.c:1319):dbcmd() bufsz = 0 (dblib.c:1369):dbsqlexec(0x7fbc6ebffe30) (dblib.c:6862):dbsqlsend(0x7fbc6ebffe30) (mem.c:615):tds_free_all_results() (util.c:156):Changed query state from IDLE to QUERYING (write.c:140):tds_put_string converting 12 bytes of "use [Emploi]" (write.c:168):tds_put_string wrote 24 bytes (util.c:156):Changed query state from QUERYING to PENDING (net.c:741):Sending packet ... You can see that the "use [dbName]" is not sent with the same way. The query is executed in "master" context, and that's why it's failing. regression from https://bugs.php.net/bug.php?id=64338 "pdo_dblib can't connect to Azure SQL" Test script: --------------- $pdo = new \PDO('dblib:host=hostname;dbname=dbname', 'username', 'password'); $stmt = $pdo->query('SELECT col FROM table WHERE id = 1'); var_dump($stmt); Expected result: ---------------- PDOStatement with the matching line from existing table Actual result: -------------- false, with this error : General SQL Server error: Check messages from the SQL Server [208] (severity 16) => Invalid object name ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=65219&edit=1