I got "Error!: could not find driver" when using PDO to connect to MSSQL
2000 running on Windows 2003 server.

I have recently installed Gentoo 2006 with Apache web server 2.0.55-r1, PHP
5.1.2, pecl-pdo 1.0.2, pecl-pdo-dblib 1.0, pecl-pdo-mysql 1.0.1, mysql
4.1.14, and freetds 0.62.3.

When I do phpinfo(), I can see:

PDO drivers with dblib, mysql enabled
PDO Driver for FreeTDS/Sybase DB-lib with freetds enabled
PDO Driver for MySQL, client library version 4.1.14

I got "Error!: could not find driver" when I run the following code:

try {
    $dbh = new PDO('mssql:host=;dbname=TEST_DB',
                   'test_user', 'test_password');

    echo "Connnected.\n";
    $dbh = null;
} catch (PDOException $e) {
    print "Error!: " . $e->getMessage() . "\n";

NOTE: I could connect to MySQL database with PDO and I also could connect to
the same MSSQL server with mssql_connect.

Could anyone help me with this problem?

Thank you very much.

Phuoc Diec.

Reply via email to