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

James K. Lowden jklowden at freetds.org
Mon May 6 20:41:01 EDT 2013


On Mon, 06 May 2013 09:38:03 -0400
Randy Syring <rsyring at gmail.com> wrote:

> Use TDSDUMPCONFIG:
> 
> http://freetds.schemamania.org/userguide/logging.htm
> 
> to make sure you are connecting the way you think you are.  The error
> is essentially saying it can't find the server.

That's good advice.  Just to clarify, though, the careful reader can
distinguish between "can't find the server" and "server didn't
answer".  

If you try "man errno", you may find the OS error messages and their
associated numbers are lists.  You saw, 

>      OS error 61, "Connection refused"

$ man errno | sed -ne '/61 /,/^$/p'

     61 ECONNREFUSED Connection refused.  No connection could be
made because the target machine actively refused it.  This usually
results from trying to connect to a service that is inactive on
the foreign host.

whereas a name lookup failure looks a little different: 

$ tsql -H no-such-host -p 17
Error 20012 (severity 2):
        Server name not found in configuration files.
...
Error 20013 (severity 2):
        Unknown host machine name.
There was a problem connecting to the server

(There should be an OS error for that, too, but the error-handling logic
has no way to pass along the fact that the error status for
gethostbyname(3) is in herror, not errno.)  

>From this we know you are reaching a machine ("locahost" was resolved,
whew!) but that machine is not answering on the port.  I would suggest
a simple TDSDUMP first, because it will tell you on one line the
address & port it's connecting to, and the TDS version. 

--jkl


More information about the FreeTDS mailing list