[freetds] freetds - invalid cursor state

jezekj at centrum.cz jezekj at centrum.cz
Fri Feb 26 14:26:07 EST 2016

Hello James,
so let me describe whole story again.
we have stored procedure:
create procedure test_me as
select getdate()
print test
select getdate()
Then we have piece of perl:
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()}
Perl is connecting through DBD::ODBC version 1.45
then we have unixODBC ( 2.3.1 ) as odbc manager, we also tried version 2.3.4
and we have both:
FreeTDS 0.91.dev.20110409RC1 (also tried FreeTDS 0.95.81), Easysoft (don't know version)
When we use easysoft driver the result set contains date, then printed text "test" and another result set contains another date.
When we use FreeTDS driver result set contains:
printed out 'test'
followed by invalid cursor state error.
When we do not fetch the second result set no error is thrown.
Sorry, but I have no idea how to understand ODBC logs.
> Od: "James K. Lowden" <james.k.lowden at icloud.com>
> Komu: <freetds at lists.ibiblio.org>
> Datum: 26.02.2016 20:00
> Předmět: Re: [freetds] freetds - invalid cursor state
On Thu, 25 Feb 2016 21:17:15 +0100
<jezekj at centrum.cz> wrote:

> Both are attached. I would really apreciate if you can take a look at
> these logs and try to identify the root cause. 

Perhaps I'm missing something, but to me it looks like a contradiction.
In the FreeTDS log, we see, 

                        SQLState = 24000
                        Native = 0x7fff2ad0ec58 -> 0
                        Message Text = [[FreeTDS][SQL Server]Invalid
cursor state]

SQL_SUCCESS is not an error, so "Invalid cursor state" cannot describe
the state.  Either the operation succeeded, or it failed because of an
invalid cursor state.  

FreeTDS mailing list
FreeTDS at lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds <http://lists.ibiblio.org/mailman/listinfo/freetds>

More information about the FreeTDS mailing list