Page 1 of 1

How to connect to MSSQL Server 2005? (Win7) 1.7.7 [SOLVED]

PostPosted: 01. December 2011 12:09
by CloeSt
So yesterday I installed Xampp and got it working easily. I have no problem connecting to MySQL. But I need to connect to MS SQL Server 2005 as well, but I can't seem to be successful in that.

So firstly, I just wana make sure if I can use Xampp to connect to MS SQL? Or do I need any additional software?

If I can... Can you please tell me what I'm doing wrong? I don't really know much about databases...
I open MS SQL Server, and select "Windows Authentication" and type in "localhost" in servername, and then click "connect".
I've also tried selecting "SQL Server Authentication" (really don't know the difference), and typed in localhost as servername, "root" as username, and left the password blank, but still no luck.
With both ways I get a "Cannot connect to localhost" message.

I also did a search, and landed here: http://www.apachefriends.org/en/faq-xampp-windows.html#phpmssql
And did the following:
If the mssql extension was loaded in the php.ini, sometimes it comes to access problems when only TCP/IP is used. You can fix that problem with a newer "ntwdblib.dll" from Microsoft. Please replace the older file in "\xampp\apache\bin" and "\xampp\php" with the new one. Because of the license, we can't package a newer version of this file with XAMPP.

I had no ntwdblib.dll file in any of the two locations mentioned, but I downloaded a new one and placed it there... still no luck.

Any help? Thanks a bunch!

Re: How can I connect to MS SQL Server 2005?

PostPosted: 01. December 2011 12:30
by Sharley
Did you uncomment (remove the ; from the start of the line) the extension line in the \xampp\php\php.ini file so it looks like this
Code: Select all
extension=php_mssql.dll
and then restart Apache?

You can check if the extension is loaded by checking in here:
http://localhost.xampp/phpinfo.php


New users can find self help by reading these first:
readme_en.txt file in the xampp folder.
http://www.apachefriends.org/en/xampp-windows.html
http://www.apachefriends.org/en/faq-xampp-windows.html

Some useful reading that may help you help us to find suitable solutions:
viewtopic.php?f=16&t=48331
viewtopic.php?f=16&t=32670

Re: How can I connect to MS SQL Server 2005?

PostPosted: 02. December 2011 22:48
by CloeSt
Hey Sharley...

Thanks for the reply... I didn't know I was supposed to do that. I uncomented it. I couldn't get my apache to restart. When I click stop, it says "Error: -1".
So, I just pressed exit, and opened it again. I then clicked on your link to see if the extension is running but it didn't open anything. (got the firfox, server not found, page).

Any help?

Just to make sure... do I need ANYTHING else to get MSSQL to work with Xamp... I read somewhere of an ODBC driver? But, I don't understand...

Re: How can I connect to MS SQL Server 2005?

PostPosted: 03. December 2011 02:13
by Sharley
OK, it seems that the php_mssql.dll and the php_pdo_mssql.dll extensions are missing from the ext folder in 1.7.7 and as far as I can tell XAMPP 1.7.3 was the last complete XAMPP version but sadly not compiled with VC9 but with VC6.
viewtopic.php?f=16&t=44327&p=173275

Now, you have downloaded and placed the ntwdblib.dll as per your first post and so all that is left is to download the missing php_mssql.dll and php_pdo_mssql.dll extensions.

I located Thread Safe (ts) VC9 versions for you found in the Apache Lounge forums (read the full topic for confidence):
http://dl.dropbox.com/u/21634/Software/php_mssql.zip

Open the archive and drag the php_mssql.ts.dll to the \xampp\php\ext folder and then rename it to php_mssql.dll (drop the ts bit).

Repeat for the php_pdo_mssql.ts.dll file - close the zip file and keep it for future use perhaps.

With the php.ini file modification I mentioned in my post above and a repeat php.ini file modification for the line (ie remove the ; from the start of the line)
Code: Select all
;extension=php_pdo_mssql.dll
...save the php.ini file, then you should be able to start Apache and test if you have access to your MS database.

I just tested on my 1.7.7 version that adding all the files mentioned and editing the php.ini file allowed Apache to start without error, the only thing I haven't tested is a M$ database connection (no interest or intentions of testing non-open source M$ products, you never know what you might catch :D), that's for you to do now. ;)

Good luck and best wishes. :)

Re: How can I connect to MS SQL Server 2005?

PostPosted: 03. December 2011 02:58
by JonB
:)
Google this
setting up SQL server 2005

This thread may get you started

http://stackoverflow.com/questions/2946 ... erver-2005

Good Luck
8)

Re: How can I connect to MS SQL Server 2005?

PostPosted: 07. December 2011 12:03
by yinsw
Thank you so much! I've installed xampp-win32-1.7.7-VC9-installer.exe and I've put in ntwdblib.dll (dated 2005-05-04) and use the php_mssql.ts.dll from the download link.. Now I can connect to my MSSQL 2000 & 2005 again. Have to further test and see if there's any problem with it..

Sharley wrote:OK, it seems that the php_mssql.dll and the php_pdo_mssql.dll extensions are missing from the ext folder in 1.7.7 and as far as I can tell XAMPP 1.7.3 was the last complete XAMPP version but sadly not compiled with VC9 but with VC6.
http://community.apachefriends.org/f/viewtopic.php?f=16&t=44327&p=173275

Now, you have downloaded and placed the ntwdblib.dll as per your first post and so all that is left is to download the missing php_mssql.dll and php_pdo_mssql.dll extensions.

I located Thread Safe (ts) VC9 versions for you found in the http://www.apachelounge.com/viewtopic.php?p=14570#14570]Apache Loungeforums (read the full topic for confidence):
http://dl.dropbox.com/u/21634/Software/php_mssql.zip

Open the archive and drag the php_mssql.ts.dll to the \xampp\php\ext folder and then rename it to php_mssql.dll (drop the ts bit).

Repeat for the php_pdo_mssql.ts.dll file - close the zip file and keep it for future use perhaps.

With the php.ini file modification I mentioned in my post above and a repeat php.ini file modification for the line (ie remove the ; from the start of the line)
Code: Select all
;extension=php_pdo_mssql.dll
...save the php.ini file, then you should be able to start Apache and test if you have access to your MS database.

I just tested on my 1.7.7 version that adding all the files mentioned and editing the php.ini file allowed Apache to start without error, the only thing I haven't tested is a M$ database connection (no interest or intentions of testing non-open source M$ products, you never know what you might catch :D), that's for you to do now. ;)

Good luck and best wishes. :)

Re: How can I connect to MS SQL Server 2005?

PostPosted: 07. December 2011 12:07
by Sharley
yinsw, would you be so kind as to add your XAMPP version and Operating System to your profile:
viewtopic.php?f=16&t=48626
Thanks. :)

Re: How can I connect to MS SQL Server 2005?

PostPosted: 07. December 2011 12:09
by yinsw
Done.. :-)

Re: How can I connect to MS SQL Server 2005?

PostPosted: 07. December 2011 12:29
by Sharley
I will close this topic now and mark it solved.