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

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

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

Postby CloeSt » 01. December 2011 12:09

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!
CloeSt
 
Posts: 4
Joined: 01. December 2011 11:56
Operating System: windows 7

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

Postby Sharley » 01. December 2011 12:30

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
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

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

Postby CloeSt » 02. December 2011 22:48

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...
CloeSt
 
Posts: 4
Joined: 01. December 2011 11:56
Operating System: windows 7

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

Postby Sharley » 03. December 2011 02:13

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. :)
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

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

Postby JonB » 03. December 2011 02:58

:)
Google this
setting up SQL server 2005

This thread may get you started

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

Good Luck
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

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

Postby yinsw » 07. December 2011 12:03

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. :)
yinsw
 
Posts: 4
Joined: 02. May 2009 08:08
Location: Penang, Malaysia
Operating System: Vista SP2, WinXP Pro SP3

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

Postby Sharley » 07. December 2011 12:07

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. :)
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

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

Postby yinsw » 07. December 2011 12:09

Done.. :-)
yinsw
 
Posts: 4
Joined: 02. May 2009 08:08
Location: Penang, Malaysia
Operating System: Vista SP2, WinXP Pro SP3

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

Postby Sharley » 07. December 2011 12:29

I will close this topic now and mark it solved.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 125 guests