[freetds] Using freetds in Windows

Andrew H. Wakefield a_wake at earthlink.net
Fri Jan 8 01:19:01 EST 2010

Still having problems with freetds 0.82 running under Windows ... here
is the latest symptom:

Using tsql, I can connect to the SQL database if I specify the Host and
port directly. If I specify the Server name, *even though it is finding
the freetds.conf file and translating to the correct IP address and
port*, it errors out. Let me make it clear: According to the log file
generated with TDSDUMPCONFIG, it *IS* finding the freetds.conf file, and
according to the TDSDUMP log file, it *IS* translating to the right IP
address and port. But for some reason, it errors out.

Here is a link to the log file:

You will see three sets of results in the log file. The first is when I
connected (successfully) using tsql with the -H and -p parameters. The
second is when I attempted to connect using the -S parameter. As you can
see from the log file, it is translating to the same IP address ... but
then it errors out. The final set is generated by a program that I am
attempting to write using wxWidgets and DatabaseLayer. It generates a
different error, but at the same point in the process -- don't know if
it is related or completely different.

I'm new enough to freetds that I am not sure of the significance of what
I'm seeing in the log file. For example, in the first two sets of data,
the initial attempt to connect seems to return an error
(tds_open_socket: connect(2) returned "Unknown error") -- but in the
first set, it then goes ahead and connects successfully, while in the
second set it then goes into an error mode and quits.


Andy Wakefield
a_wake at earthlink.net 

> > On Thu, 2009-12-31 at 06:30 -0500, Paul Thurston wrote:
> > > On Windows, if your using v0.82, you'll need to set the environment
> > > variable FREETDSCONF to point to your freetds.conf file.
> > > 
> > > Also, remember to escape the file path sequence as follows: SET
> > > FREETDSCONF=C:\\Apps\\FreeTDS\\etc\\freetds.conf
> > > 
> > > In the freetds.con file itself, make sure that line host=<Address> is
> > > a valid IP address to the database server.
> > >
> > Andrew H. Wakefield wrote:
> > Paul, many thanks -- that took care of the problem with tsql. Now I just
> > need to figure out what my program is doing differently from tsql, and
> > maybe I'll finally get this show on the road ...
> Andrew, remember TDSDUMPCONFIG will show where config.c is looking for
> your freetds.conf, and the final communication parameters for the
> connection.  
> The sample programs and unit tests may serve as examples for your own
> application.  
> HTH.  
> --jkl

More information about the FreeTDS mailing list