Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

PHP Error: Warning: mssql_connect() [function.mssql-connect]: Unable to connect to se

Options
  • 07-10-2009 4:13pm
    #1
    Registered Users Posts: 224 ✭✭


    Hi

    Im getting this error from a site Im working on.

    Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: server in C:\Freight\common.inc.php on line 3

    the connection string is

    <?php
    session_start();
    mssql_connect("server", "freight_mssql", "tandoM1");
    mssql_select_db("spk_freight");
    ?>

    Its obviously something to do with the connection but i dunno where to start.

    any ideas guys?


Comments

  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    There should be additional information as to why you couldn't connect; Incorrect password, etc.

    Couple of immediate things to try:

    1. Log onto the SQL Server using the username and password above.
    2. If that works, run the command "USE spk_freight;"
    3. If that works, check that you can ping the SQL server from the web server.


  • Registered Users Posts: 610 ✭✭✭nialo


    Im guessing your server name is incorrect. try the server ip.


  • Registered Users Posts: 224 ✭✭The Mighty Dubs


    seamus wrote: »
    There should be additional information as to why you couldn't connect; Incorrect password, etc.

    Couple of immediate things to try:

    1. Log onto the SQL Server using the username and password above.
    2. If that works, run the command "USE spk_freight;"
    3. If that works, check that you can ping the SQL server from the web server.


    These are all the errors that are coming up...

    Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: server in C:\Freight\common.inc.php on line 3

    Warning: mssql_select_db() [function.mssql-select-db]: Unable to connect to server: (null) in C:\Freight\common.inc.php on line 4

    Warning: mssql_select_db() [function.mssql-select-db]: A link to the server could not be established in C:\Freight\common.inc.php on line 4

    Warning: mssql_query() [function.mssql-query]: Unable to connect to server: (null) in C:\Freight\functions.express.php on line 5

    Warning: mssql_query() [function.mssql-query]: A link to the server could not be established in C:\Freight\functions.express.php on line 5

    Warning: mssql_num_rows(): supplied argument is not a valid MS SQL-result resource in C:\Freight\functions.express.php on line 6

    Warning: mssql_result(): supplied argument is not a valid MS SQL-result resource in C:\Freight\functions.express.php on line 13

    Warning: mssql_query() [function.mssql-query]: Unable to connect to server: (null) in C:\Freight\functions.final.php on line 896

    Warning: mssql_query() [function.mssql-query]: A link to the server could not be established in C:\Freight\functions.final.php on line 896

    Warning: mssql_num_rows(): supplied argument is not a valid MS SQL-result resource in C:\Freight\functions.final.php on line 897

    Warning: mssql_result(): supplied argument is not a valid MS SQL-result resource in C:\Freight\functions.final.php on line 904

    Warning: mssql_query() [function.mssql-query]: Unable to connect to server: (null) in C:\Freight\functions.final.php on line 1124

    Warning: mssql_query() [function.mssql-query]: A link to the server could not be established in C:\Freight\functions.final.php on line 1124

    Fatal error: Maximum execution time of 30 seconds exceeded in C:\Freight\functions.final.php on line 1124


  • Registered Users Posts: 224 ✭✭The Mighty Dubs


    nialo wrote: »
    Im guessing your server name is incorrect. try the server ip.

    I changed the server name to the IP its sitting on and still the same...


  • Registered Users Posts: 6,509 ✭✭✭daymobrew


    I changed the server name to the IP its sitting on and still the same...
    Where did you get the server connection info? Does it match what you are using?

    BTW, the code should be checking that it was able to connect to the server before selecting a db or doing queries. mssql_connect returns FALSE if it doesn't connect.


  • Advertisement
  • Registered Users Posts: 224 ✭✭The Mighty Dubs


    hi,

    you see the funny thing is that this connection was working all along and then decided to drop. As far as i can make out sql server is up and running fine and so is IIS. So its a real noggin scratcher to why its not connecting up.

    One thing that it may have caused it (im just guessing here) is that i was cleaning up old redundant users in the active directory of that server, would it be possible that by deactivating or deleting old profiles that i may have knocked it off that way?


  • Registered Users Posts: 6,465 ✭✭✭MOH


    Can you see anything in the server access/auth logs?


  • Registered Users Posts: 9,579 ✭✭✭Webmonkey


    I'm assuming that the neccessary ports are opened on the firewall?


Advertisement