On Mon, 6 Jan 2003 19:41:20 -0500 (EST) Paul Boutros <[EMAIL PROTECTED]> 
wrote:

> This is the situation in which I've found the finish() method to be
> required using DBD::ODBC. It appears that every second execute statement
> is dying.  I am using:
> WinXP
> Perl 5.8.0 (ActiveState)
> DBI 1.30 (from ActiveState)
> DBD::ODBC 0.43 (from ActiveState)
> 
> Paul
> 
> ### CODE ##########
> use strict;
> use DBI;
> 
> my $dbh = DBI->connect("dbi:ODBC:test_data");
> 
> my $sql1 = "select daughter from daughters";
> my $sql2 = "select count(*) from spot_assignment where daughter = ?";
> my $sth1 = $dbh->prepare($sql1);
> my $sth2 = $dbh->prepare($sql2);
> 
> $sth1->execute();
> 
> while (my $daughter = $sth1->fetchrow_array()) {
>         $sth2->execute($daughter);
>         my $count = $sth2->fetchrow_array();
> 
>         if ($count) {
>                 print "$daughter\t$count\n";
>                 }
> 
>         # $sth2->finish() # if this is uncommented runs smoothly
>         }
> 
> ### Output ########
> H3006D11        1
> DBD::ODBC::st execute failed: [Microsoft][ODBC Driver Manager] Invalid
> cursor state (SQL-24000)(DBD: st_execute/SQLExecute err=-1) at test.pl
> line 15.
> H3006E01        7
> DBD::ODBC::st execute failed: [Microsoft][ODBC Driver Manager] Invalid
> cursor state (SQL-24000)(DBD: st_execute/SQLExecute err=-1) at test.pl
> line 15.

This was discussed at length last week.

http://www.rosat.mpe-garching.mpg.de/mailing-lists/dbi/2003-01/msg00047.html

-- 
Mac :})
** I normally forward private questions to the appropriate mail list. **
Ask Smarter: http://www.tuxedo.org/~esr/faqs/smart-questions.html
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.

Reply via email to