[freetds] Unable to connect: Adaptive Server is unavailable or does not exist

James K. Lowden jklowden at freetds.org
Wed May 8 00:15:02 EDT 2013

On Tue, 7 May 2013 10:30:48 +0545
Krish <krishna.sunuwar at gmail.com> wrote:

> The SQL Server is not in localhost, but it is in machine called
> db_server. Access to db_server is restricted to mid_server. I created
> tunnel with
> $ssh -L 1433:db_server:1433 user at mid_server
> The above port forwardign is working for Navicat. I can connect
> localhost:1433 via Navicat and access all database in db_server. I
> also can telnet localhost 1433. So main problem is freeTDS not working
> port forwarding. Is there any way to get this work?
> and my config is:
> [sqlserv]
> host = localhost
> port = 1433
> tds version = 7.0

I don't know Navicat, but if that works, then FreeTDS should work,
too.  Probably just a small configuration error.  


	$ TDSVER=7.0 tsql -H localhost -p 1433

That should work.  If not, you'll have to get ssh to tell you what's
going on.  You could also try tracing the Linux system calls.  FreeTDS
just opens a TCP connection, nothing fancy, same as telnet.  

If the above command works and "tsql -S" does not, then FreeTDS is not
looking at your freetds.conf file.  To see why not, try:

	$ TDSDUMPCONFIG=dump tsql -S sqlserv

and look at the "dump" file.  Usually the output is clear enough to let
the reader diagnose the problem.  



More information about the FreeTDS mailing list