Subject: | $dbh->begin_work dies if the connection timed out |
Hi,
If the connection to the mysql database timed out, I get an error
message when doing a $dbh->begin_work:
DBD driver has not implemented the AutoCommit attribute at /home/perl/
lib/x86_64-linux-gnu-thread-multi/DBI.pm line 1702
I'm using DBI 1.609, perl 5.10.0
It can be reproduced by setting the "wait_timeout" in the mysql server
to 1 minute, for example, and then try the following code:
use DBI;
my $dbh = DBI->connect("dbi:mysql:...", $user, $pass, { AutoCommit =>
1 });
# just to show that begin_work works normally
$dbh->begin_work;
$dbh->do(qq{DELETE FROM something WHERE id = 123});
$dbh->commit;
sleep 70;
# but not after a connection timeout
$dbh->begin_work;
I have severe problems with my mod_perl application because after the
timeout, every request which does an insert as a first statement dies
and therefor produces a 500 server error. This bug seems to be existing
at least since 4.00 (or maybe something in DBI changed).
The error message is not appearing if I do a select or any other
statement directly before the begin_work.
Normally the error message should be that the server connection has
gone away, which the code is expecting and then doing a reconnect.
regards,
tina