ID: 48539
Comment by: thomas dot parrott at jellyfish dot co dot uk
Reported By: frase at cs dot wisc dot edu
Status: Open
Bug Type: PDO related
Operating System: Ubuntu 9.04 Jaunty
PHP Version: 5.3.0RC4
New Comment:
This issue appears to be in 5.2.10 as well.
Previous Comments:
------------------------------------------------------------------------
[2009-06-19 13:40:03] frase at cs dot wisc dot edu
This problem remains in RC4.
------------------------------------------------------------------------
[2009-06-12 19:59:51] frase at cs dot wisc dot edu
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 this bug report at http://bugs.php.net/?id=48539&edit=1