[freetds] dbsqlok() after dbrpcsend() hangs
Tim Cook
tim at palare.demon.co.uk
Thu Jul 5 05:56:00 EDT 2007
I'm trying to port some existing code from using the Sybase db-lib to
using freetds and I've encountered the following behaviour which I've
managed to isolate in a test program which works ok when I build
against the Sybase library but doesn't work as expected when building
against the freetds library:
o/s: SunOS 5.8 / Solaris 8 (sun4u/sparc)
freetds: v0.64 built using gcc v3.4.6
Sybase: v12.0
My example code executes a stored procedure and displays the results.
dbrpcinit(dbproc, "storedproc", 0);
dbrpcsend(dbproc);
dbsqlok(dbproc);
dbresults(dbproc);
...
The above code works fine when built using the Sybase library but
when I execute it with the freetds library the program hangs in
dbsqlok(). Using gdb to debug the code it looks as if dbsqlok() is
eventually calling select() to wait for a response from the server
which it never gets and it just sits there. Setting a timeout in the
freetds.conf file causes the select() to timeout as expected but it
still doesn't work.
As far as I can tell from reading the documentation, executing a
dbsqlok() after a dbrpcsend() is the correct thing to do.
I've also played around using dbcmd() to execute both queries
(select) and stored procedures and that seems to work fine with
dbsqlok() working as expected. Its only when I use dbrpcsend() that I
encounter the problem. Unfortunately I'm dealing with legacy code and
I probably don't have too much freedom in what I can change so I'm
hoping I can get round this problem still using dbrpcsend().
Is there something I've forgotten to setup prior to the dbrpcsend()
call and is it worth building the test above against an earlier (or
the nightly snapshot) version of the tds library?
Thanks.
Tim
More information about the FreeTDS
mailing list