[freetds] freetds and windows

James K. Lowden jklowden at schemamania.org
Sat Apr 9 12:38:27 EDT 2005


Brett <generica at email.com> wrote:
> 
> Using dblib, I got the client program working perfectly.  It could talk
> to the ms sql server, get the results back, and work as I'd hoped.
> 
> The next plan was to compile it under windows, which I thought would be 
> straightforward.  We already had the system compiling under windows,
> with faked calls for the sql stuff, so it was just a case of using the
> freetds code, and linking it in with the windows libraries.

Ah, but it is not straightforward. :-(  As you found, the VC++ project in
the win32 directory builds the ODBC driver only.  If you update it to
build db-lib, I would be glad to include your version in the main
distribution.  

> I went into the win32 directory, used msvc to load the projects, and 
> compiled dblib.lib and libTDS.lib ... compiled and linked those into our
> 
> software ( also had to link shell32.lib, due to some unresolved symbols
> )

shell32.lib?  That's a surprise.  What does db-lib need from that?  

> Went to run it, and with the aid of printfs, found that it initialised
> the library fine, but at the following call, it just terminates
> 
> erc = dbsqlsend(dbproc);

The function is provided by dblib.c:

$ cd build/src/dblib/.libs
$ file * |grep ELF | awk -F: '{print $1}' |xargs nm -o |grep dbsqlsend
dblib.o:00006f68 T dbsqlsend
libsybdb.so.5.0:0000ec5c T dbsqlsend

Can you run your test in the debugger and find out where it dies?  Does
TDSDUMP tell you anything?  If the process dies sending the login packet,
try TDSVER=4.2.  TDS 4.2 login packets are logged by TDSDUMP, so you
should at least see that much in your log.  

HTH.  

--jkl



More information about the FreeTDS mailing list