Jump to content

Connection Error


Recommended Posts

I was an ASP programmer and now trying to convert to php.  I cannot get my driver to connect to the database.  The issue is the same if I use PDO or the older method. 

 

Here is the connection string...

 

try {
  # MS SQL Server and Sybase with PDO_DBLIB
  $DBH = new PDO("mssql:host=$hostname; dbname=$database;" , $username, $password);
  echo "Connected to Test<br>";
}
catch(PDOException $e) {
    echo "Error=" . $e->getMessage();
}

 

Here is the result...

Error=could not find driver

 

I have found this page and done everything on it but still does not connect....

http://stackoverflow.com/questions/2852748/pdoexception-could-not-find-driver

 

Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/286984-connection-error/
Share on other sites

The link you posted to is for the MySQL database PDO driver. This is not the same driver for accessing an MSSQL (Microsoft SQL) database

 

To access an MSSQL database with PDO you either have to use the ODBC PDO driver or download the MSSQL driver provided by Microsoft, linked to in the manual here

Link to comment
https://forums.phpfreaks.com/topic/286984-connection-error/#findComment-1472689
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.