Results 1 to 6 of 6

Thread: connecting to mssql

  1. #1

    Thread Starter
    Fanatic Member lerroux's Avatar
    Join Date
    Nov 2005
    Location
    Welcome to the darkside... we have cookies
    Posts
    646

    connecting to mssql

    hi,

    i have a mssql server 2005 database on a windows server 2003 machine and would like to connect to it from my php webserver which is a centos based server.

    i tried the mssql_connect() from my php code and it gave me the error:

    Code:
    Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: {sql server ipaddress}
    i installed wamp on my winxp workstation and tried it there. got the same error.

    i can connect to the sql server from my winxp using the sql dev studio.

    i also tried to google and found several workarounds:

    i'm sure php.ini has extension=php_mssql.dll and mssql.secure_connection = Off

    and i also have ntwdblib.dll in all directories, system32, apache2/bin, php

    no use.

    still got the same error

    help!

    cheers,
    lerroux
    WARNING: Excessive coding is dangerous to your health... if symptoms persist insult your doctor...

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: connecting to mssql

    post your code? you aren't seriously trying to connect to "{sql server ipaddress}," are you? (hopefully, you just removed your IP address from being paranoid!)

    make a phpinfo file (file containing a call to the phpinfo() function) and make sure that the MSSQL extension is actually registering. you should be able to do a find on the page and search for "mssql." if nothing is found, then the extension isn't being loaded.

  3. #3

    Thread Starter
    Fanatic Member lerroux's Avatar
    Join Date
    Nov 2005
    Location
    Welcome to the darkside... we have cookies
    Posts
    646

    Re: connecting to mssql

    Code:
    <?php
    $myServer = "ipaddress";
    $myUser = "myuname";
    $myPass = "mypassword";
    $myDB = "ARIAL1"; 
    
    //connection to the database
    $dbhandle = mssql_connect($myServer, $myUser, $myPass)
    or die("Unable able to connect to $myServer"); 
    
    //select a database to work with
    $selected = mssql_select_db($myDB, $dbhandle)
      or die("Couldn't open database $myDB"); 
    
    ?>
    got that code from other forums. seems to be working for them.
    WARNING: Excessive coding is dangerous to your health... if symptoms persist insult your doctor...

  4. #4
    Frenzied Member
    Join Date
    May 2003
    Location
    So Cal
    Posts
    1,564

    Re: connecting to mssql

    They probably put in their IP address where it says "ipaddress", along with their username and password for the DB.

  5. #5

    Thread Starter
    Fanatic Member lerroux's Avatar
    Join Date
    Nov 2005
    Location
    Welcome to the darkside... we have cookies
    Posts
    646

    Re: connecting to mssql

    i know that. i just replaced it with ipaddress so that i wont be posting my real ip address here...

    anyone know how i get around with this?
    WARNING: Excessive coding is dangerous to your health... if symptoms persist insult your doctor...

  6. #6
    New Member
    Join Date
    May 2009
    Posts
    1

    Re: connecting to mssql

    I am also running into the same problem right now. My development box (WAMP) won't talk to the MSSQL box, but my SQL Client (Squirrel) does just find. Also, the ODBC connection test in Vista works, as well.

    I've tried the new DLL, checking to make sure the information is listed in PHPInfo, and even a couple other things, but I'm still stumped. Any further advice would be amazing.

Posting Permissions

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



Click Here to Expand Forum to Full Width