Page 1 of 1

PDO dblib driver loaded, but not working

Posted: Thu Nov 02, 2006 7:14 pm
by RobertGonzalez
Can anyone tell me why this code:

Code: Select all

<?php
print_r(PDO::getAvailableDrivers());
?>
which produces this output

Code: Select all

Array
(
    [0] => dblib
    [1] => mysql
    [2] => odbc
    [3] => sqlite
)
would, when called according to the manual, result in this code:

Code: Select all

<?php
try {
	$dbh = new PDO("dblib:host=hostname;dbname=dbname", "user", "password");
	echo 'We have a database connection;';
} catch (PDOException $e) {
	echo "Failed to get DB handle: " . $e->getMessage();
	exit;
}
?>
Returning this message:
Failed to get DB handle: SQLSTATE[] (null) (severity 0)
If the drivers are there, and I can connect to the database with the native database functions, why can I not connect with PDO? The database in question is Sybase. The client is installed and running, the sybase_* functions are working correctly, but for some reason PDO will not talk to it. PDO connects with no problem to MySQL.