[freetds] RES: Adaptive Server connection failed (Php + freetds)

James K. Lowden jklowden at freetds.org
Fri Jun 20 11:12:36 EDT 2008


Frederick William Borges Pohl wrote:
> If I change the tds version parameter to 7.0 on the freetds.conf and run
> tsql, I get the same error as before:
>  
> ./tsql -S <ip_name> -U <user_name>
> 
> Msg 20009, Level 9, State -1, Server OpenClient, Line -1
> Unable to connect: Adaptive Server is unavailable or does not exist
> There was a problem connecting to the server
> 
> Since I'm  not using the -H parameter, tsql should read the freetds.conf
> file which I already specified the tds version to 7.0

Oh, so close!  

When you use "tsql -S xyz", you're directing FreeTDS to search
freetds.conf for "xyz".  Literally, all it does is scan the file for a
section that looks like [xyz].  It doesn't interpret the string in any
way.  

So, when you say "tsql -S "192.168.1.5", FreeTDS looks for a section in
freetds.conf headed by [192.168.1.5].  

I'm guessing you have no such section in your file.  If that's the case,
FreeTDS will do what it always does when no section is found: it begins
trying to interpret the string. Eventually it succeeds, because you
provied a valid IP address.  But it of course falls back on its
compiled-in default for the TDS version.  In your case, that's 5.0, and it
fails to connect to the Microsoft server.  

Simple, right?  :-/  I actually think all the guessing and interpretation
is too clever by half.  It confuses people and serves very little purpose,
especially in a properly configured system.  

HTH.  

--jkl




More information about the FreeTDS mailing list