'PDOException' with message 'could not find driver'

Problems with the Windows version of XAMPP, questions, comments, and anything related.

'PDOException' with message 'could not find driver'

Postby bruceaj » 26. December 2013 19:33

I get the following error message

'PDOException' with message 'could not find driver'


This is the block of code that generates the error message.

Code: Select all
$connectParm = 'mssql:host=localhost;dbname=ervitals;charset=utf8,ervitals,Ejoe2tedR@';

   $connect = new PDO($connectParm); // The failure occurred on this line

   $SQL = "SELECT obituaryid,datafileid FROM obituaries";
   $SQL .= " WHERE year=?";
   
   $stmt = $connect -> prepare($SQL);
   $year = $_POST['txtYear'];
   $stmt -> bindParam(1,$year);
   
   $stmt -> execute();


What do I need to do to eliminate this problem?

Thank you..
bruceaj
 
Posts: 25
Joined: 15. December 2012 17:37
Operating System: Windows 8

Re: 'PDOException' with message 'could not find driver'

Postby Altrea » 26. December 2013 20:00

You want to use the pdo mssql driver but did not install it.
http://www.php.net/manual/en/ref.pdo-sqlsrv.php
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8297
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: 'PDOException' with message 'could not find driver'

Postby bruceaj » 27. December 2013 03:33

I must have it installed because PDO works in another page I have. Since it works on another page, I must have a code problem somewhere but I don't know what to look for. I was going to reinstall XAMPP until I saw this other page.
bruceaj
 
Posts: 25
Joined: 15. December 2012 17:37
Operating System: Windows 8

Re: 'PDOException' with message 'could not find driver'

Postby Altrea » 27. December 2013 03:38

bruceaj wrote:I must have it installed because PDO works in another page I have.

PDO is not the problem, the missing mssql database driver is the problem.

bruceaj wrote:Since it works on another page, I must have a code problem somewhere

No, you have a missing mssql database driver problem.

bruceaj wrote:I was going to reinstall XAMPP until I saw this other page.

reinstallation of XAMPP will not solve the problem.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8297
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 54 guests