Collected posts: Oracle, SQL, PL/SQL, Performance, Security...(More than 300 blogs)

vendredi 10 octobre 2014

PERL = DBI::db = disconnect invalidates 1 active statement handle (either destroy statement handles or call finish on them before disconnecting)




  1. $dbh = DBI->connect("DBI:ODBC:$dsn",$user,$password)
  2. my $statement=$dbh->prepare(q{select count(*) Total from tab;});
  3. $statement->execute() or  die "executing: ", $dbh->errstr;
  4. my $rowq = $statement->fetchrow_arrayref->[0];
  5.  
  6. $dbh->disconnect;



DBI::db=HASH(0x1d56afc)->disconnect invalidates 1 active statement handle (either destroy statement handles or call finish on them before disconnectin
g) at chb.pl line 6.


to avoid this you should add  $statement->finish();


  1. $dbh = DBI->connect("DBI:ODBC:$dsn",$user,$password)
  2. my $statement=$dbh->prepare(q{select count(*) Total from tab;});
  3. $statement->execute() or  die "executing: ", $dbh->errstr;
  4. my $rowq = $statement->fetchrow_arrayref->[0];
  5.  
  6. $statement->finish();
  7. $dbh->disconnect;

Aucun commentaire:

Enregistrer un commentaire