[freetds] unixODBC failing to connect.

Lowden, James K LowdenJK at bernstein.com
Tue Apr 15 16:19:42 EDT 2003

> From: Jeff Honey [mailto:jhoney at psmanagement.net]
> Sent: April 15, 2003 10:07 AM
> FreeTDS .61 (stable)
> unixODBC 2.2.5
> I have had a tremendously difficult time in getting what at 
> first appeared
> to be a relatively simple thing to work. Everything compiled 
> and installed
> flawlessly but after a number of earnest attempts, I am still 
> without ODBC
> to my MSSQL server from my linux box. tsql testing seems to 
> bear out that
> FreeTDS works connecting directly to the server, though. 
>                 Entry:            
>                         Connection = 0x804f018            
>                         Server Name = [testserver][length = 

OK, you're going to try to connect to "testserver".  

>                 DIAG [S1000] Client unable to establish connection

... and don't. :( ...

> contents of TDSDUMP:
> 2003-04-15 09:32:38.219047 iconv will convert client-side 
> data to the ""
> character set
> 2003-04-15 09:32:38.220719 IP address pointer is NULL
> 2003-04-15 09:32:38.220741 Server SYBASE not found!

... because the FreeTDS driver was not passed a valid servername.  

> [testserver]
> Driver          = TDS
> Description     = Northwind sample database
> Trace           = yes
> Servername      =
			^^^^^^^^^^^^  should be "testserver".
> Database        = Northwind
> UID             = sa
> [global]
>         tds version = 4.2
>         initial block size = 512
>         swap broken dates = no
>         swap broken money = no
>         text size = 64512   
> [testserver]
   ^^^^^^^^^^ Put this in the "Servername" entry, above
>         host = testserver.foo.com
>         port = 1433
>         tds version = 8.0

The ODBC driver reads ODBC.INI to get the "real" servername, which it passes
to FreeTDS (which in turn looks up the ip address of the name in the "host"

If you don't change anything, and set TDSDUMPCONFIG, I think you'll see
FreeTDS trying to connect to but failing because the TDS
version number isn't right.  When FreeTDS can't resolve a name to an address
(gethostbyname() fails), it will try using the passed string as an address.
Not much of a feature anymore, really.  

I think you'll be OK if you change the "Servername" entry in ODBC.INI: 

	Servername = testserver

because you have [testserver] in freetds.conf. 

You don't *have* to use both these files.  We tried to make that clear in
the User Guide.  http://www.freetds.org/userguide/x1853.htm.  Anything you
can do to make that more understandable would be welcome. :-)



The information contained in this transmission may contain privileged and
confidential information and is intended only for the use of the person(s)
named above.  If you are not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, any
review, dissemination, distribution or duplication of this communication is
strictly prohibited. If you are not the intended recipient, please contact
the sender immediately by reply e-mail and destroy all copies of the
original message. Please note that we do not accept account orders and/or
instructions by e-mail, and therefore will not be responsible for carrying
out such orders and/or instructions.

More information about the FreeTDS mailing list