Skip to Content.
Sympa Menu

freetds - [freetds] freetds - invalid cursor state

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: <jezekj AT centrum.cz>
  • To: <freetds AT lists.ibiblio.org>
  • Subject: [freetds] freetds - invalid cursor state
  • Date: Tue, 09 Feb 2016 21:22:08 +0100


Hi guys, we have to find some solution.
 
We have perl script using DBD::ODBC to connect to MSSQL using unixODBC driver
and FreeTDS. When we execute stored procedure and this stored procedure is
executing another stored procedure with raiserror or print functions we get
invalid cursor state error.
 
i.e.:
CREATE PROCEDURE [dbo].[dummyproc] as
RAISERROR('test', 0, 0)
return 0
 
CREATE PROCEDURE [dbo].[testproc] as
select GETDATE()
exec dummyproc
select GETDATE()
return 0
 
This happens ONLY when we try to fetch results from second getdate() function.
i.e.:
my $query = 'exec testproc';
my $sth   = $dbh->prepare($query);
$sth->execute || die "Error running query $query";
while ( my $d = $sth->fetchrow_arrayref ) {
    print Dumper $d; #should return first getdate()
}
while ( my $d = $sth->fetchrow_arrayref ) {
    print Dumper $d; #should return second getdate()
}
 
We’re using:
Old perl 5.8.8.
DBD::ODBC version 1.45
unixODBC 2.3.1 (also tried newest 2.3.4.)
FreeTDS 0.91.dev.20110409RC1 (also tried FreeTDS 0.95.81)
 
In case we use Easysoft database driver instead of FreeTDS the error does not
appear.
When I call out the procedure from tsql error does not appear.
 
The log using latest FreeTDS can be found here:
http://jezecek.dyndns.org/freetds.log
The unixODBC log (not sure it will help) can be found here:
http://jezecek.dyndns.org/odbc.log
 
I would really really appreciate if you can let me know what to focus on.
Thank you for any hints& supprt from you.
 
Regards,
JJ





Archive powered by MHonArc 2.6.24.

Top of Page