Using ODBC on Linux to connect to MS SQL Server

Daniel Bruce Lynes dlynes1 at
Tue Aug 8 21:34:38 EDT 2000

On Tue, 8 Aug 2000, Tomaz Borstnar wrote:

> At 20:37 7.8.00, you wrote:
> >I am new to this list, so forgive me if this has been answered before.
> >
> >Has anyone successfully used the FreeTDS ODBC driver under Linux or any
> >other Unix based system to connect to MS SQL?  I have gotten as far as
> I can't even compile it under FreeBSD.
> Some time later...
> Well, seems like you need glib which is in FreeBSD ports (devel/glib12) and 
> link /usr/local/bin/glib-config to glib2-config and use gmake.
> Now it is time to test it. how do I do it? :-)
> Any plans to support UnixODBC too? (already mailed author of UnixODBC to 
> check freetds)
> I installed in into unixodbc with odbcinst, but when I try to use it I get 
> this:
> [unixODBC][Driver Manager]Can't open lib 
> '/usr/local/freetds/lib/' : /usr/local/freetds/lib/libtd
> Undefined symbol "g__numeric_bytes_per_prec" (SQL-IM003)(DBD: 
> db_login/SQLConnect err=-1) at 
> /usr/local/lib/perl5/site_perl/5.005/i386-freebsd/DBI/ line 743

When you link the tds library against the ODBC library, link against the
libfreetds.a file, not the .la files.  unixODBC cannot handle the freetds
library being linked in, dynamically.

I've had freetds/unixODBC working for a while.  However, when I've got time,
I've been trying to get enough functionality in the ODBC driver so that it's
actually usable.  I haven't had a chance to work on it for a couple of weeks

However, when I last worked on it, I was forcing an insert string, which was
working (i.e. no SQLBindParameter()).  Also, I found the SQLBindColumn() and/or
SQLFetch() is not quite working properly.  I just haven't had a chance to fully
understand why it's not working, and fix it.

unixODBC installation code is also written for the freetds ODBC driver, and is
part of the unixODBC CVS tree, already.

I haven't tried getting it to work with libc5 or FreeBSD.  It works just fine
with glibc2.1.2, however.  I suspect at this point in time, guaranteeing libc5
compatibility is not a high priority.  However, if we want to it to work in a
low-memory environment, libc5 compatibility will be needed eventually and/or
Java2 compatibility for the JDBC driver.

GNU make is definitely required.  Never tried using any other make tool.

I've also never tried getting it to work with MS SQL.  I've been trying to get
it to work with Sybase SQL server first.  Once I've got that working, I'll be
trying to get it to work with MS SQL server.  The main reason for this priority
sequence for me is that MS SQL server does not run on Linux or UNIX; Sybase

Btw...even if you solve the g__numeric_bytes_per_prec problem (by a hack of the
code), you'll run into a slew more problems.  Linking in the .a file is the only
real way of solving it.


More information about the FreeTDS mailing list