Welcome to WebmasterWorld Guest from 23.20.8.182

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP, PDO, ODBC and MSSQL

It just seems impossible

     
2:03 pm on Mar 19, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 12, 2004
posts: 789
votes: 0


Days like this makes me loathe Microsoft!

I'm trying to connect to a MSSQL Server (2005 Express) through PHP. I understand that the mssql_connect() and the php_mssql.dll are old and shouldn't be used, so the next best thing is PDO's MSSQL extension. It's a pain, and that doesn't seem to work either. So then I've gone and got PDO's ODBC extension and am trying to set up a DSN for the connect, but I can't figure it out, is this right:

new PDO('odbc:database=somedb;UID=someuid;PWD=somepwd;DSN=myDSNConn');

Any ideas?

6:48 am on Mar 21, 2008 (gmt 0)

Senior Member from MY 

WebmasterWorld Senior Member vincevincevince is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Apr 1, 2003
posts:4847
votes: 0


Most people quickly migrate their database to MySQL or Postgresql and be done with it. One painful conversion for a lifetime of ease to follow!
11:30 am on Mar 21, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 12, 2004
posts: 789
votes: 0


MySQL is installed as a service, but I'm trying to connect to 2005 SQL server because an ASP.NET based web site uses that database.