[freetds] Connecting MSSQL Server from Red Hat linux + PHP

Venkatraman M Srinivasan mlmsrini at lycos.com
Wed Jul 2 19:16:46 EDT 2003


Hi
I have installed php-4.3.2 and compiled --with-mssql=/usr/local.
No errors occured during compilation. Now i am getting the mssql support description for the first time in the phpinfo list.

Then i tried with the sample php code.
<?
// connectivity test
$conn = mssql_connect("MYSERVER70",$user,$pswd)
    or die( "Connection to MSSQL SERVER failed" );
// Also i 've tried this
$conn = mssql_connect("192.168.4.25:1433",$user,$pswd)
// Then tried with this - For SQL Server 2000 we have to use , instead of : for the port number - some suggest this
$conn = mssql_connect("192.168.4.25,1433",$user,$pswd)

  $query = mssql_query("SELECT product_name from product",$conn);
  while ($row=mssql_fetch_array($query)) {
    $prodName=$row["product_name"];
    echo ("Product - ".$prodName."<br>");
	}
?>
Now i am getting the error
'Warning: mssql_connect(): Unable to connect to server: MYSERVER70 in /home/httpd/test/test.php on line 4'
ERROR: Connection to MSSQL SERVER failed
It's throwing the die part.

(Previously i was getting the error 'Fatal error: Call to undefined
>>>function: mssql_connect() in /home/httpd/test/test.php on line 4'.)

This means now it is working for mssql extensions.
But now the problem is with the MSSQL Server connectivity.

I have specified this in freetds.conf file which is inside /usr/local/etc.
[MYSERVER70]
        host = 192.168.4.25 // MSSQL Server's IP
        port = 1433
        tds version = 7.0
Also i have got the same file freetds.conf inside my /usr/local/freetds/ folder. I have specified the above server specification in this file aswell. I don't know which one to use.
Is the problem because of this?. If so can i delete one freetds.conf file which is not needed.
So in general it seems i am very close to achieve the MSSSQL Server connectivity.

Any suggestions?

Thanks

svan



____________________________________________________________
Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail!
http://login.mail.lycos.com/r/referral?aid=27005


More information about the FreeTDS mailing list