DBD::InterBase::st fetchrow_arrayref failed:

2004-01-07
2004-02-25
  • Carlos Kassab
    Carlos Kassab
    2004-01-07

    If i try to run the next script:

    use DBI;
    use infotarif::infotarif;
    use strict;
    do 'config.pl';
    my ( $dbh, $dbh1, $qsitios, $compresult, $site, $company, $desc );

    $dbh = DBI->connect($cfginfotarif::mydbdata,$cfginfotarif::dbusername,$cfginfotarif::dbpassword) or die "Cannot connect to '$cfginfotarif::mydbdata'" ;

    $qsitios = $dbh->prepare ("SELECT SITIO FROM SITIOS") or die "Cannot SELECT from SITIOS ";
    $qsitios -> execute  or die "Cannot execute SELECT from SITIOS";
    $qsitios -> bind_columns(undef, \$site);

    while( $qsitios -> fetchrow_arrayref )
    {
        $compresult = $dbh->prepare ("SELECT COMP, DESCCOMP FROM COMPANIAS") or die "Cannot SELECT from COMPANIAS ";
        $compresult -> execute  or die "Cannot execute SELECT from COMPANIAS";
        $compresult -> bind_columns(undef, \$company, \$desc);

        while( $compresult -> fetchrow_arrayref )
        {
            print "Company: $company, $desc\n";
        }
        $compresult -> finish();
    }
    $qsitios -> finish();

    and i run perl myscript.pl it works fine but if i run:
    perl -w myscript.pl it works too but i have the next error message:

    DBD::InterBase::st fetchrow_arrayref failed: Unknown cursor
    -Dynamic SQL Error
    -SQL error code = -504
    -Cursor unknown
    DBD::InterBase::st finish failed: The cursor identified in a FETCH or CLOSE statement is not open.
    -Dynamic SQL Error
    -SQL error code = -501
    -Attempt to reclose a closed cursor
    DBI handle cleared whilst still active.
        dbih_clearcom (sth 0x19bdd20 0x0, com 0x19c691c, imp DBD::InterBase::st):
           FLAGS 0x115: COMSET Active Warn PrintError
           PARENT DBI::db=HASH(0x19bd62c)
           KIDS 0 (0 Active)
           IMP_DATA undef
           NUM_OF_FIELDS 1
           NUM_OF_PARAMS 0

    If i use two conections i do not get any error but what i know is that with DBI i can do many queries at the same time using the same connection.

    I am using activestate perl 5.82, DBI 1.39 and firebird 1.03.

    Thank you very much in advance for your help.

    Carlos Kassab

     
    • Carlos Kassab
      Carlos Kassab
      2004-01-07

      I forgot to say that i am using DBD-InterBase-0.41-fb1-perl58.zip

      Thank you again for your help

       
    • Edwin Pratomo
      Edwin Pratomo
      2004-02-25

      You have nested statement handles, so you should turn AutoCommit off or use ib_softcommit attribute instead.
      This topic is already covered in DBD::InterBase::FAQ.