Skip to Content.
Sympa Menu

freetds - [freetds] Unable to connect to MS SQL 2000

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: rconner AT commspeed.net
  • To: FreeTDS AT lists.ibiblio.org
  • Cc:
  • Subject: [freetds] Unable to connect to MS SQL 2000
  • Date: Wed, 24 Mar 2004 13:26:44 -0700 (MST)

I have installed and compiled php to use FreeTDS. It seems like php is
understanding and executing the "mssql_connect", but each time it fails to
authenticate. When I installed FreeTDS I used ./configure
–with-tdsver=4.2

This is my php code (of course the information changed to be generic):

<?php

$myServer = "myserver";
$myUser = "myuser";
$myPass = "mypass";
$myDB = "mydb";


$s = mssql_connect("myserver", "$myUser", "$myPass")
or die("Couldn't connect to SQL Server on $myServer");
echo "Connected(1)";

$d = mssql_select_db($myDB, $s)
or die("Couldn't open database $myDB");
echo "Connected(2)";

$query = "SELECT whatever
FROM there";

$result = mssql_query($query);
$numRows = mssql_num_rows($result);

echo "This a test";

while($row = mssql_fetch_array($result))
{
echo "<br>$row[0]</br>";
}

?>

Now I do get an error message “Couldn't connect to SQL Server on
myserver”, so I know that it is carrying the Variable…and is attempting
the $s = mssql_connect. Before I had FreeTDS installed it would not show
anything, just a blank page.

Also in my phpinfo() page I see ‘./configure'
'--with-apxs2=/usr/local/apache2/bin/apxs' '--with-mysql'
'--with-sybase=/usr/local/freetds/' , so that looks good.


I edited the /usr/local/freetds/etc/freetds.conf as follows:

# This is a Sybase hosted database server, if you are directly on the
# net you can use it to test.
[JDBC]
host = 192.138.151.39
port = 4444
tds version = 5.0

# The same server, using TDS 4.2. Used in configuration examples for the
# pool server, since the pool server supports only TDS 4.2.
[JDBC_42]
host = 192.138.151.39
port = 4444
tds version = 4.2

# The client connecting to the pool server will use this to find its
# listening socket. This entry assumes that the client is on the same
# system as the pool server.
[mypool]
host = 127.0.0.1
port = 5000
tds version = 4.2

# A typical Microsoft SQL Server 7.0 configuration
[MyServer70]
host = myserver
port = 1433
tds version = 4.2

# A typical Microsoft SQL Server 2000 configuration
[MyServer2k]
host = myserver
port = 1433
tds version = 4.2

# A typical Microsoft SQL Server 6.x configuration
;[MyServer65]
; host = ntmachine.domain.com
; port = 1433
; tds version = 4.2


I think that’s about all the information I can give you. Hope someone out
there understands what the issue is.


Thanks for your time,


Ryan





Archive powered by MHonArc 2.6.24.

Top of Page