SQL Server Invalid cursor state (SQL-24000) on FreeTDS but not on SQLSRV32.dll

Dennis Lichtenthäler <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Organization Ev. Stiftung Tannenhof
Message-ID <[email protected]>
Hi,

I'm currently transitioning a Perl web application from a Windows Server 2003 
machine to a Linux box. It uses the Perl DBD::ODBC module to talk to a 
Microsoft SQL Server 2005.

I've installed FreeTDS 0.82 on the Linux box using unixODBC 2.3.0 and 
connecting to/querying the database works great, with isql (from unixODBC) as 
well as with a simple Perl script.

There appears to be, however, a difference in implementation between FreeTDS 
and the Windows SQL DLL which boils down to this:

my $test=$db->prepare("select getdate()") or die($!);
$test->execute();
print $test->fetchrow_array();

my $test2=$db->prepare("select getdate()") or die($!);
$test2->execute();
print $test2->fetchrow_array();

This short test script (after connecting to the database which I ommitted for 
brevity) is supposed to "select getdate()" twice on the database and fetch the 
result.

On the Windows machine this works and gives the expected result.

Using FreeTDS the script outputs the date once but then dies on the second 
execute() with:

DBD::ODBC::st execute failed: unixODBC FreeTDS SQL Server Invalid cursor state 
(SQL-24000)

If I change the first "fetch" to loop while there is still data to get (as in 
while($test->fetchrow_array()) { print; }), the script runs fine but I'm 
wondering what is going on here.

FreeTDS (I suppose) seems to think there is still data to fetch, leaves the 
first statement active and falls over when I try to run a second, apparently 
parallel statement. But why doesn't it notice that there is no more data?

If you need any more info, I'd gladly supply it. I know this is rather specific  
but I really don't know where else to ask.

Regards,

Dennis


-- 
Evangelische Stiftung Tannenhof
Fachkrankenhaus für Psychiatrie, Psychotherapie,
  Psychosomatik und Neurologie

Remscheider Str. 76
42899 Remscheid

Telefon: (0 21 91) 12 - 11 33
Telefax: (0 21 91) 12 - 13 56

www.stiftung-tannenhof.de
[email protected]

_______________________________________________
FreeTDS mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/freetds
signature.asc (application/pgp-signature, 836 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)

iQIcBAABCAAGBQJL/iM9AAoJEH9/z1pmf8H1lHAP/1ezu0tiSlmHHafv/de0XRH3
aDJAkmNUZg22wofNbRqOihjWy9sRgLxkbNmVjl1DJLQDR0NvkOUGwKsrXQojlNxe
pSqjlZbrS4KT1qEWwk2ZdeaaRlc75T5i3liE/p1uBozwMnUk5omDshISC/5lXlUk
68KwJLjj736XArC6LJGknp4RAN9dWY/UbncYso9hZoi0Rh7Mtlfk7Ia4QVQsfdoE
zzNCfOAtFEqd2JvBHWhjqn5JeykSJ+5ztREKgH50qxNPNGfhmBrRHdCyK5H2dynB
PoNVps5hczXl7J/2PuktkG2nrAV8OTSM1zybH6M0miaAr7DtxHXKlMNu6jDKQs+c
TilcfL0tZ3ou7g3dmhbCcwKsDDSFIUsFg6mwko7Hq5ZLahPv7bylWu6YPs5FH7sk
Cmq31Z1TXw6qXF/5CQh4RRx6H7FCQNCHs5WSqAWC9K/QzJWM1e9ul0fVUSOc3rWi
DTCo+kHxXp4I158ft56xyRG2jVcvWY9h2buDbqGvnqCjvYTvXKJ/8Z/vRg//sM5/
xW3vTZoEx3gpNZ4uK68CAqIyLU9rsDPqBntiBdQQ86rb0YOWRcHepGTNU5KJYdcQ
7Ja8PXB/fVBDK6XcHl5xYTjvjQXsON+/fvJJQBCAYs8T3kPqH0dX/jNiqrVdKi7/
1FqLRNK35g1gSYw5hfur
=I9H0
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.