Results 1 to 13 of 13
  1. #1
    Join Date
    Aug 2003
    Location
    India
    Posts
    109

    Unanswered: Unable to connect to mssql server using sql express

    Hi,

    I installed Sqlexpress server 2005 and am able to connect to the server using the sqlexpress manager.

    The connection parameters are:

    server: 127.0.0.1 (This is an alias name pointing to TMD03\SQLEXPRESS)
    username:sa
    password:test
    mode: sql server and windows authentication mode
    TCP/IP : enabled and listening on port number 1433.

    But I am not able to connect to the server using PHP's mssql_connect function.

    I tried various combinations like

    mssql_connect("127.0.0.1","sa","test")
    mssql_connect("local","sa","test")
    mssql_connect("localhost","sa","test")
    mssql_connect("TMD03\SQLEXPRESS","sa","test")
    mssql_connect("127.0.0.1,1433","sa","test")

    but none of them works. I also tried OSQL and SQLCMD and they don't work either. They give me the following error message.

    [SQL Native Client]Named Pipes Provider: Could not open a connection to SQL
    Server [2].
    [SQL Native Client]Login timeout expired
    [SQL Native Client]An error has occurred while establishing a connection to
    the server. When connecting to SQL Server 2005, this failure may be caused by
    the fact that under the default settings SQL Server does not allow remote
    connections.

    Can anyone please let me know what am doing wrong here?

    Regards,
    Celia

  2. #2
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    you have to use the "Surface Area Configuration Manager" to turn on allow remote connections. this tool should be installed with sql express.

    here's a link that shows you how to do it:
    http://searchsqlserver.techtarget.co...tml?bucket=ETA
    Last edited by jezemine; 10-13-06 at 03:51.

  3. #3
    Join Date
    Aug 2003
    Location
    India
    Posts
    109
    Yes, it is set to accept both local and remote connections. The PHP and Sql server sit on the same machine.

    Also, I followed up on this below url and did whatever was said in it.

    http://www.interaktonline.com/Produc...ss.html?last=1

    But it also doesn't help me. How could I debug this and find out where the problem is?

  4. #4
    Join Date
    Jul 2002
    Posts
    229
    Are Names Pipes enabled on the server side?

  5. #5
    Join Date
    Aug 2003
    Location
    India
    Posts
    109
    Yes. It is enabled. Is there a step by step procedure to check whether I have done/not done something?

  6. #6
    Join Date
    Aug 2003
    Location
    India
    Posts
    109
    Found the problem. The problem is caused by the newer ntwdblib.dll version in system32 directory.

    I got the one suggested by

    http://www.interaktonline.com/Produc...ss.html?last=1

    and it works fine now.

  7. #7
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Quote Originally Posted by rexselin
    Found the problem. The problem is caused by the newer ntwdblib.dll version in system32 directory.
    Strictly an observation on my part, but I've always found the arbitrary copying of DLL files to be one of the most interesting forms of "digital suicide" because you never know in advance just when it will strike. I always find the tension that knowing it is going to blow up, but not knowing when or how to be exhilarating!

    I've always been the old fashioned type, and resolved this type of problem by finding the necessary service pack or upgrade to make products like PHP and MS-SQL compatible. That way all of the products on my systems are in vendor supported configurations...

    -PatP

  8. #8
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    Quote Originally Posted by Pat Phelan
    Strictly an observation on my part, but I've always found the arbitrary copying of DLL files to be one of the most interesting forms of "digital suicide"
    -PatP
    oh pish posh. it's a lot of fun cludging things together. I have seen people get around liscensing by swapping in the right DLL. Not my current employer of course. Cheesing around in the registry can get you places too. And it is all the more fun when you do this on a clients server and they run into a issues a couple of years down the line and then they hire you back on as a consultant to figure why they can't upgrade or whatever. Hack away. Do not bother to back up the registry, databases or other goodies first. It will be fine.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  9. #9
    Join Date
    Aug 2003
    Location
    India
    Posts
    109
    Quote Originally Posted by Pat Phelan
    I've always been the old fashioned type, and resolved this type of problem by finding the necessary service pack or upgrade to make products like PHP and MS-SQL compatible. That way all of the products on my systems are in vendor supported configurations...

    -PatP
    Can you please let us know what service pack or upgrade you did to fix this problem? That way, I can also follow the protocol. I didn't find one proper link helping me out till I found that good samaritan telling what he did for his installation.

    Also, it is quite odd to see that the latest version of ntwdblib.dll doesn't support php-mssql compatability but an older version does.

  10. #10
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    The NTWDBLIB.DLL functionality has been depricated since the release of SQL-2000. The DLLs are included on the SQL Express CD, and are supported as legacy code by Microsoft if installed from the CD. Some PHP extensions still rely on DbLib because they haven't been updated to use more secure protocols...

    PHP itself doesn't care, and it will definitely support the newer SQL Server protocols. These make your server and everything it does MUCH safer. You can almost always find newer and better supported PHP extensions if you look for them.

    -PatP

  11. #11
    Join Date
    Aug 2003
    Location
    India
    Posts
    109
    Thanks a lot for the information. I was trying to use PHP's mssql extension since the software I installed uses mssql functions to connect to a sql server database. If this is the only extension available and it relies on dblib, then I think I don't have another choice. Do I?

    I downloaded the sql express software from microsoft site and the NTWDBLIB.DLL file I got didn't work with mssql extension. I had to use an older version (I downloaded it from webzilla.com) for that.

    What should I do if a similar issue crops up later?

  12. #12
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    It has been a while (about a year) since I've installed PHP, and I've always used the ODBC connectivity as described at Builder, but I've never had a problem. Is using ODBC an option for you, or do you have to use the code that is causing you the problems?

    Mixing the DLLs from different versions of a product scares me. Kind of like when you've got a 1992 Blazer with a bad brake cylinder, and you've got the cylinder from a 1993 handy. The cylinders the same size, with the same fittings, so they ought to work just fine, right? You put them on, and test the replacement cylinder, and life is good... Your wife and kids drive off to visit grandma, and discover on the side of the mountain that the piston throw stops way too short, so as their brakes heat up they loose braking ability.

    Maybe it is just me, but I get so many calls when people play Frankenstein with software versions. While there aren't many cases where people will die from it, servers die all of the time. I hate getting calls at "oh-dark-thirty" because somebody tried a kludge, it worked in the lab, then they rolled it out to dozens or hundreds of production servers and watched it crumple under load.

    -PatP

  13. #13
    Join Date
    Aug 2003
    Location
    India
    Posts
    109
    You explained it right. But I ain't got an option. I have to use php_mssql.dll. I wonder what the PHP people got to say about this.

    However, thanks for the reply. I would take a look at Builder and try to use it for my own projects.

    - Celia

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •