Re: [Dbi-interbase-devel] 901 / expecting explicit transaction start
Status: Beta
Brought to you by:
edpratomo
From: Daniel R. <dan...@gm...> - 2001-07-16 20:24:54
|
ok, i can see the problem. the problem is, that the dbd forgots to start a new transaction after a commit, followed by an execute w/o a prepare between commit and execute. but in autocommit mode it works. i'll try to solve the problem soon... regards -daniel ps for marco: wieso hast du autocommit auf off wenn du ja nach einem insert gleich ein commit machsts? versuch doch mal autocommit auf on zu setzen und den commit wegzulassen.. eine andere methode wäre autocommit = off und do() zu verwenden. dann kannst du zwar nicht mit bind_param arbeiten, aber mit $dbh->quote kannst du die werte quoten und direkt in den string einsetzen... ----- Original Message ----- From: "Marco Schlünß" <pri...@sc...> To: <dbi...@li...> Sent: Monday, July 16, 2001 8:08 PM Subject: Re: [Dbi-interbase-devel] 901 / expecting explicit transaction start > hi Daniel, > > > i can't reproduce the error. i made a test database and a test script doing the same > > thing as described. it works without any problem. it uses two database connections > > and copies the content form one table to another. i tested it with two connections > > to the same database and with connections to two different databases. > > i use the once prepared statement serveral times for inserting data. after each insert i > do commit, the code worked fine with version 0.21, but from 0.27 on i get the following: > > DBD::InterBase::st execute failed: Unsuccessful execution caused by system error that d > oes not preclude successful execution of subsequent statements > -Dynamic SQL Error > -SQL error code = -901 > -invalid transaction handle (expecting explicit transaction start) > Could not update last update of groups of server at /mnt/serverspace/prog/news/store_gr > > > you can find the test database and the test script at: > > http://ritz.dnsart.com/interbase/ > > thank you for your help, but i could not see anything, that i would have done wrong? > but here's the code pasted together (it's spread over serval modules), perhaps you can see > something: > > my $db_connect = > "dbi:InterBase:database=/var/interbase/tndb.gdb;ib_dialect=3;ib_charset=ISO8859_1"; > my $db_user = "NEWS_S"; > my $db_passwd = "NEWS_S"; > print "Try to connect.." if ($debug); > if (!defined($sel_nws_dbh)) > { > # database-handle just for selects > print "sel->" if ($debug); > $sel_nws_dbh = DBI->connect($db_connect, $db_user, $db_passwd, {RaiseError=>0}) or die > $DBI::errstr; > print "OK.." if ($debug); > } > > if (!defined($mod_nws_dbh)) > { > # database-handle just for modifications > print "mod->" if ($debug); > $mod_nws_dbh = DBI->connect($db_connect, $db_user, $db_passwd, > {AutoCommit=>0,RaiseError=>0}) or die "connect:\n".$DBI::errstr; > print "OK.." if ($debug); > } > print "..I'am connected\n" if ($debug); > > sub sth_upd_server_last_upd > { > if (!defined($upd_server_last_upd)) > { > my $sql_upd_server_last_upd = <<EOF; > update nws_server > set nws_server_last_grp_upd = ? > where nws_server_idx = ? > EOF > $upd_server_last_upd = $mod_nws_dbh->prepare( $sql_upd_server_last_upd) or > dbherror( $mod_nws_dbh, "preparing upd_server_last_upd"); > } > return $upd_server_last_upd; > } > > < here comes now serveral other statements, that get prepared in the same way as > $upd_server_last_upd > > my $upd_server_last_upd=sth_upd_server_last_upd(); > > < now the program is ready and waiting for data, this can take time, so i have: > > > local $SIG{ALRM} = sub { $sel_nws_dbh->ping(); $mod_nws_dbh->ping(); alarm > $cfg_time_for_db_ping }; > > < because Interbase would cut the connection otherwise > > > < finally, then the programm exits, it trys to increase a timestamp-field, and there it > pops up the error > > > $upd_server_last_upd->bind_param( 1, strftime( "%Y-%m-%d %H:%M:%S", localtime( > $start_time-60))); > $upd_server_last_upd->bind_param( 2, $nws_server_idx); > $upd_server_last_upd->execute() or die "Could not update last update of groups of server"; > if ($use_commit) > { > $mod_nws_dbh->commit(); > } > > > this is not the only place, i get this error, there are serveral others. i could life with > a workaround, if there's one, because it's my newsdatabase, i really looking forward to > get it running again... > > cu, Marco > -- > Marco Schluenss pri...@sc... > S-H-K www.schluenss.com > Spinnerstr. 35 Tel 0531/576450 > 38114 Braunschweig > > _______________________________________________ > Dbi-interbase-devel mailing list > Dbi...@li... > http://lists.sourceforge.net/lists/listinfo/dbi-interbase-devel > |