[freetds] Trouble connecting to SQL Server 2005 instance

Steve Werby smwerby at vcu.edu
Mon Aug 7 11:30:10 EDT 2006


I have a PERL application on a Linux server, which used to query a SQL 
Server 2000 database on default port 1433 via DBD::Sybase and FreeTDS. 
The database was migrated to a SQL Server 2005 instance on port 11433, 
which I'm unable to connect to.  I can connect to and query a table on 
the same server, which is not an instance.  I've searched this list's 
archives and Google, but haven't found the cause of my problem or a 
solution.

I don't have root user privileges on the Linux server.  I installed my 
own PERL installation and libraries more than a year ago because the 
global PERL installation was old and the necessary libraries weren't 
installed.  I'm not the DBA for the SQL Server box, but the DBA is 
willing to help me resolve the problem.

Select lines from freetds.conf:

tds version = 8.0
[<alias>]
         host = <host>
         port = 11433

PERL connection code:

sub dbconnect_sqlserver_test_1b
{
$c_dbname = join '','DBI:Sybase:server=<alias>';
$c_acct = '<user>';
$c_passwd = '<password>';

$dbh = DBI->connect($c_dbname, $c_acct, $c_passwd)
or &error_html("Couldn't connect to database: " . DBI->errstr);

return $dbh;
}

PERL output:

src/tds/login.c: tds_connect: <ip>:11433: No route to host DBI connect

PERL output if specify port in DBI code as follows:

$c_dbname = join '','DBI:Sybase:server=<alias>:11433';

DBI connect('server=<alias>:11433','<user>',...) failed: (no error string)

telnet output:

telnet <ip> 11433

Trying <ip>...
telnet: connect to address <ip>: No route to host

Can connect to port 1433.

tsql output:

tsql -H <host> -p 11433 -U <user>
locale is "en_US"
locale charset is "ISO-8859-1"
Password: <password>
src/tds/login.c: tds_connect: <ip>:11433: No route to host
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

Can connect to port 1433, where the user also has an account.

freetds.log output (debug level = 10):

11:17:09.427366 Connecting to <ip> port 11433, TDS 8.0.
11:17:09.429000 tds_client_msg: #20009: "Server is unavailable or does 
not exist.".  Connection state is now 0.

PERL - 5.8.5
DBI - 1.4.1
DBD::Sybase - 1.04
FreeTDS - 0.62.4
OS - Red Hat 7.3, kernel - 2.4.9

-- 
Steve Werby
Office of Information Technology
VCU School of Dentistry
804-827-1585
smwerby at vcu.edu




More information about the FreeTDS mailing list