Skip to Content.
Sympa Menu

freetds - [freetds] Attempting to connect to MS SQL

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Jamie Lawrence <freetds-lists-ibilio-org AT jal.org>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] Attempting to connect to MS SQL
  • Date: Tue, 22 Feb 2005 18:41:25 -0500


Hi folks,

I've tried searching the archives, so far to no avail.

I'm attempting to connect to a SQL Server 2K machine via FreeTDS, for an
Apache/mod_perl/DBD::ODBC app from a Debian/Stable machine.

My first attempt was with the .deb for FreeTDS, which is quite old:

$Id: tds.h.in,v 1.9 2001/12/03 00:06:14 brianb Exp $

After setting up, I could only connect through ODBC (isql) if I had a
$HOME/.odbc.ini config file - it appears to ignore /etc/odbc.ini . So,
it would work interactively, but a local config isn't an option for my
application ($ENV{HOME} is not defined).

So, I built from source (FreeTDS-stable as of last Friday), and have
been playing with that version since then, and cannot connect at all.

My odbc.ini uses (currently) this entry (I'm attempting to go the "ODBC
Only" route described in the online docs):

[testdsn]
Description = Test sql server config
Driver = /usr/local/freetds/lib/libtdsodbc.so
Servername = xxx.xxx.xxx.xxx
UID = xxx
PWD = xxx
Port = 1433
Database = test
TDS_Version = 4.2

(I've tried it with TDS_Version set to 7.0 and 8.0 as well; 4.2 is
what the really old libraries I tried first were using for a successful
interactive connect.)

Out of Isql, i get

$ isql -v testdsn xxx xxx
[unixODBC][FreeTDS][SQL Server]Unable to connect to data source
[ISQL]ERROR: Could not SQLConnect


Setting logging on, the operative errors seem to be;

18:05:56.409119 IP address pointer is NULL
18:05:56.409265 Server SYBASE not found!

From a looks of a couple of messages in the archives, it appears that
this indicates that the DSN is not being picked up, or perhaps it is
falling back to looking for a default server 'SYBASE'.

Is that accurate? None of my {odbc.ini, odbcinst.ini, freetds.conf} have a
definition for that name.

I must admit to still being mildly confused as to the role of the
freetds.conf file when attempting an ODBC only config, and have been
trying various combinations of params scattered there, too, but if
anyone could whack me with a cluestick, I'd be much obliged.

For reference, a DSN that worked with the really old libs is:

[dsnold]
Description = minimal working version
Driver = FreeTDS
Servername = xxx.xxx.xxx.xxx
UID = xxx
PWD = xxx
Port =
Database = test

With the odbcinst.ini entry:

[FreeTDS]
Description = TDS driver (Sybase/MS SQL)
Driver = /usr/lib/odbc/libtdsodbc.so
Setup = /usr/lib/odbc/libtdsS.so
CPTimeout =
CPReuse =
FileUsage = 1

Thanks in advance,

-j





Archive powered by MHonArc 2.6.24.

Top of Page