Jump to content


Connection Error

  • Please log in to reply
1 reply to this topic

#1 2minutes2midnight

  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 15 March 2014 - 02:16 AM

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....



Any ideas?

#2 Ch0cu3r

  • Moderators
  • Advanced Member
  • 3,418 posts

Posted 15 March 2014 - 09:44 AM

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

Edited by Ch0cu3r, 15 March 2014 - 09:48 AM.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users