php - Connect to SQL Server 2008 with PDO -


I try to connect on SQL Server 2008 (not express) with PHP 5.2.9-2 on Windows XP SP2 I am doing I can connect remote SQL Server properly from SQL Server Management Studio from the same machine

My first attempt was to:

  $ conn = new PDO ("mssql : Host = {$ host}; dbname = {$ db} ", $ user, pass $);  

returns this error:

 PHP Fatal Error: Unable to connect to the 'Exclusive' PDOException 'message from the message' SQLOSTATE [0100]: whether SQL Server is unavailable or not Present Access denied. (Intensity 9) second attempt (found on) 

  $ conn = new PDO ("odbc: driver = {SQL server native client} 10.0}; server = {$ host}; database = { $ Db}; UID = {$ user}; PWD = {$ pass} ", $ user, $ pass);  

This works, but I can not use the PDO :: lastInsertId () , which I want to be able to:

 Driver does not support this function: driver does not support previous InsertId () 

Do you have any suggestions? Any help would be greatly appreciated.

I'm sure that to connect PW with MSSQL data server type dblib do you have a machine Is deblib installed? Make sure that you can find ntwdblib.dll in the path on your system anywhere. I know that you can not find this error message, but I'm not sure if I trust the error message.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -