Page 1 of 1

mssql_connect, odbc_connect error

Posted: Thu Aug 20, 2009 6:29 am
by dejvos
Hi,

I've problem with connecting to a remote MSSQL database. I'm trying it with both ways mssql_connect() and odbc_connect() and every time a get same error.
For mssql_connect()
Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: 192.168.1.100 in /var/www/localhost/htdocs/pokus.php on line 14
and for odbc_connect()
Warning: odbc_connect() [function.odbc-connect]: SQL error: [unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect in /var/www/localhost/htdocs/pokus.php on line 17
The script is:

Code: Select all

 
<?php
 
$x = mssql_connect($server,$user,$psswd);
if(!$x) echo 'M:'.mssql_get_last_message();
odbc_connect("Driver={SQL Server Native Client 10.0};Server=$server;Database=$db;",$user,$psswd);
?>
 
 
I've tried MSSQL with tsql and result is:

Code: Select all

locale is "C"
locale charset is "ANSI_X3.4-1968"
Msg 20009, Level 9, State 0, Server OpenClient, Line 0
Server is unavailable or does not exist.
There was a problem connecting to the server
It's pain in my neck, because I don't know MSSQL almost nothing and I need to get some suggestions of where could be a problem. Couldn't it be because of missing of a some library? Which librery? Bad ODBC set up?

Many thanks for EVERY suggestion!

Re: mssql_connect, odbc_connect error

Posted: Thu Aug 20, 2009 8:24 am
by Ollie Saunders
I'd use a client application to see if you can actually connect to that database at all. Is the database not running or perhaps firewalled?

Re: mssql_connect, odbc_connect error

Posted: Fri Aug 21, 2009 4:00 am
by dejvos
It's solved ... it was a bad setup of a sever and someone forgot to open the 1433 port. Damned I've been solving it whole day. I've askign provider status of Firewall for a million times and he tolds that me that everithing is OK for 999 999 times.