Code: Select all
<?php
print_r(PDO::getAvailableDrivers());
?>Code: Select all
Array
(
[0] => dblib
[1] => mysql
[2] => odbc
[3] => sqlite
)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;
}
?>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.Failed to get DB handle: SQLSTATE[] (null) (severity 0)