From:             frase at cs dot wisc dot edu
Operating system: Ubuntu 9.04 Jaunty
PHP version:      5.3.0RC3
PHP Bug Type:     PDO related
Bug description:  pdo_dblib fails to connect, throws empty PDOException 
"SQLSTATE[] (null)"

Description:
------------
I have compiled PHP 5.3.0RC3 from source as a module for Apache 2.2.11,
and I cannot open a connection to an MSSQL server using PDO's dblib
(FreeTDS) driver.  Instead, I get a PDOException with no SQLSTATE code or
message.

The sample code below works in PHP 5.2.6 (as packaged for Jaunty).

Non-PDO MSSQL connections work ("mssql_connect()").

PDO MySQL connections also work ("PDO('mysql:...')").

"phpinfo()" confirms that the PDO extension is loaded, with dblib and
mysql drivers.  The pdo_dblib section confirms that it is using FreeTDS.

There is no change by compiling the extensions (mssql, pdo, pdo_dblib) as
external shared modules or built-in to libphp5.so.


Reproduce code:
---------------
<?php
header('Content-type: text/plain');

try {
        $db = new PDO('dblib:host=myhost;dbname=mydb', 'myuser', 'mypass') or
die("failed to connect");
        $result = $db->query('select count(1) from mytable') or die ("failed to
query database");
        echo "got ".($result->fetchColumn())." rows\n";
        $result->closeCursor() or die("failed to free resultset");
        $db = null;
} catch (Exception $e) {
        echo $e;
}


Expected result:
----------------
got (some-number) rows

Actual result:
--------------
exception 'PDOException' with message 'SQLSTATE[] (null) (severity 0)' in
/home/user/htdocs/test-pdo.php:5
Stack trace:
#0 /home/user/htdocs/test-pdo.php(5):
PDO->__construct('dblib:host=myho...', 'myuser', 'mypass')
#1 {main}

-- 
Edit bug report at http://bugs.php.net/?id=48539&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=48539&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=48539&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=48539&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=48539&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=48539&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=48539&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=48539&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=48539&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=48539&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=48539&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=48539&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=48539&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=48539&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=48539&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=48539&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=48539&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=48539&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=48539&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=48539&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=48539&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=48539&r=mysqlcfg

Reply via email to