CodeIgniter Forums
Connect to MS SQL Express 2008 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Connect to MS SQL Express 2008 (/showthread.php?tid=22299)



Connect to MS SQL Express 2008 - El Forum - 09-04-2009

[eluser]obiron2[/eluser]
Hi Guys,

I am trying to connect my development environment to MS SQLExpress 2008 on the same machine
I am using a laptop running Vista Home Premium
I have downloaded MS Visual Studio 2008 Express and installed all elements into their default locations. I have disabled IIS7 and installed Xammp
All my existing CI applications work (CI 1.6.something rather than CI 1.7)

I have created a new database in SLQExpress2008 called TestDB
I have created a new user (TestUsr,TestPwd) with full sysadmin rights to the new database

Does anyone know what settings I need to put into my database config file because I don't seem to be able to make it work when using server = "Localhost", driver = "mssql", database = "TestDB", User = "TestUsr", Password = "TestPwd"


Thanks in advance

Obiron


Connect to MS SQL Express 2008 - El Forum - 09-05-2009

[eluser]wabu[/eluser]
Hey, since nobody answered I'll take a stab at this one.

I think the server value might need to be the name of your SQL Server instance, something like "MYCOMPUTER\SQLWHATNOT."

You should be able to view the instance name by opening the SQL management tool (that either comes with Express or is downloadable separately) and looking at the entry at the top of the server tree list.


Connect to MS SQL Express 2008 - El Forum - 09-05-2009

[eluser]wabu[/eluser]
Yeah, check this out:

http://www.php.net/manual/en/function.mssql-connect.php

The example there uses "KALLESPC\SQLEXPRESS". If that doesn't work read the comments too, because some people had to use ".\SQLEXPRESS".


Connect to MS SQL Express 2008 - El Forum - 09-07-2009

[eluser]obiron2[/eluser]
Thanks guys,

I have finally worked it out with PHP natively (i.e. not via CI) and will post a full solution here are soon as I have fully tested it with CI.

There is an updated .dll that is required in the apache/bin folder and you need to change some of the default settings in SQLExpress to accept SQL logins as well as NTAUTHORISATION, plus allow named pipes and TCP/IP connections.

Oh - and don't forget to turn of IIS7 !! Smile

currently I can't get it to use the database configuration and create a connection string that will return me a results set from a query (I seem to be connecting to the database as CI throws no errors, but the results set is empty)