Skip to Content.
Sympa Menu

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

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Dennis Lichtenthäler <dennis.lichtenthaeler AT stiftung-tannenhof.de>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] SQL Server Invalid cursor state (SQL-24000) on FreeTDS but not on SQLSRV32.dll
  • Date: Thu, 27 May 2010 09:45:55 +0200

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
dennis.lichtenthaeler AT stiftung-tannenhof.de

Attachment: signature.asc
Description: This is a digitally signed message part.



  • [freetds] SQL Server Invalid cursor state (SQL-24000) on FreeTDS but not on SQLSRV32.dll, Dennis Lichtenthäler, 05/27/2010

Archive powered by MHonArc 2.6.24.

Top of Page