[freetds] Connecting to Sybase with perl+DBI::ODBC results in an error?

Peter C. Norton spacey-freetds.org at ssr.com
Wed Dec 1 10:05:44 EST 2010


On Wed, Dec 01, 2010 at 02:56:19PM +0100, Frediano Ziglio wrote:
> > 0000 0f 01 00 2a 00 00 00 00-21 1d 00 00 00 00 57 48 |...*.... !.....WH|
> > 0010 49 4c 45 20 40 40 54 52-41 4e 43 4f 55 4e 54 20 |ILE @@TR ANCOUNT |
> > 0020 3e 20 30 20 43 4f 4d 4d-49 54                   |> 0 COMM IT|
> >
> > token.c:539:tds_process_tokens(0xb9b1e40, 0x7fffdfcd8f5c, 0x7fffdfcd8f58, 0x100)
> > util.c:156:Changed query state from PENDING to READING
> > net.c:546:Received header
> > 0000 04 01 00 08 00 00 00 00-                        |........|
> >
> > net.c:600:Received packet
> > 0000 04 01 00 08 00 00 00 00-                        |........|
> >
> 
> empty reply packet ??

Your response makes it seem like this is unusual.  Is there a unittest
for this that I can run to provide a better test case?  I do see that
when I run this via pyodbc and try to see something similar:

def the_test(db_name):
    db = pyodbc.connect("DSN=%s;UID=USER;PWD=PASSWORD;DATABASE=tempdb;APP=python;autocommit=False" % db_name)
    db.autocommit=True
    db.autocommit=False
    db.autocommit=True
    [etc.]

this results in a tdsdump that looks like this:

odbc.c:235:change_autocommit: executing BEGIN TRANSACTION
mem.c:615:tds_free_all_results()
util.c:156:Changed query state from IDLE to QUERYING
util.c:156:Changed query state from QUERYING to PENDING
net.c:730:Sending packet
0000 0f 01 00 1f 00 00 00 00-21 12 00 00 00 00 42 45 |........ !.....BE|
0010 47 49 4e 20 54 52 41 4e-53 41 43 54 49 4f 4e    |GIN TRAN SACTION|

token.c:539:tds_process_tokens(0x1c3a2da0, 0x7fffcb87019c, 0x7fffcb870198, 0x100)
util.c:156:Changed query state from PENDING to READING
net.c:546:Received header
0000 04 01 00 11 00 00 00 00-                        |........|

net.c:600:Received packet
0000 04 01 00 11 00 00 00 00-fd 04 00 01 00 00 00 00 |........ ........|
0010 00                     -                        |.|

[skipping to the next instance of change_autocommit()]

odbc.c:235:change_autocommit: executing WHILE @@TRANCOUNT > 0 COMMIT
mem.c:615:tds_free_all_results()
util.c:156:Changed query state from IDLE to QUERYING
util.c:156:Changed query state from QUERYING to PENDING
net.c:730:Sending packet
0000 0f 01 00 2a 00 00 00 00-21 1d 00 00 00 00 57 48 |...*.... !.....WH|
0010 49 4c 45 20 40 40 54 52-41 4e 43 4f 55 4e 54 20 |ILE @@TR ANCOUNT |
0020 3e 20 30 20 43 4f 4d 4d-49 54                   |> 0 COMM IT|

token.c:539:tds_process_tokens(0x1c3a2da0, 0x7fffcb87021c, 0x7fffcb870218, 0x100)
util.c:156:Changed query state from PENDING to READING
net.c:546:Received header
0000 04 01 00 2c 00 00 00 00-                        |...,....|

net.c:600:Received packet
0000 04 01 00 2c 00 00 00 00-fd 05 00 01 00 00 00 00 |...,.... ........|
0010 00 fd 01 00 02 00 00 00-00 00 fd 01 00 02 00 00 |........ ........|
0020 00 00 00 fd 00 00 02 00-00 00 00 00             |........ ....|

etc.  Does this look more correct?

> > util.c:331:tdserror(0xb9ae0a0, 0xb9b1e40, 20017, 115)
> 
> 20017 == EOF however 115 == EINPROGRESS (at least on my system).
> Perhaps read/recv on Solaris returns EINPROGRESS which is misdetected
> as an error... quite strange... or 115 is another error on Solaris...

It's not defined in include/sys/errno.h:

$ grep 115 /usr/include/sys/errno.h
$ grep -B1 -A1 EINPROGRESS /usr/include/sys/errno.h
#define EALREADY        149     /* operation already in progress */
#define EINPROGRESS     150     /* operation now in progress */

any ideas about where this is coming from?  In the mean time, I'll try
to see if I can delay/change where in the connection the autocommit is
set and see if that helps.

-Peter



More information about the FreeTDS mailing list