perl-DBD-mysql-4.012 doesn"t autoreconnect

perl-DBD-mysql-4.012 doesn"t autoreconnect

am 15.07.2009 15:29:09 von Claude Lecommandeur

Hi,

I upgraded a few weeks ago to perl-DBD-mysql-4.011 and
mysql-server-5.0.45 and whet used to work doesn't work anymore. Whenever
the server restarts or times out connections, the automatic reconnection
doesn't occur. I am left with the dreaded 'MySQL server has gone away'
message.

I upgraded to perl-DBD-mysql-4.012 witn no success. This little code
snippet shows the problem :

#!/usr/bin/perl
#
use strict;
use DBI;
use DBD::mysql;
#
my $dsn = "DBI:mysql:database=dinfo;host=localhost:mysql_server_prepar e=1";
my $dbh = DBI->connect ($dsn, 'dinfo', 'password', {'RaiseError' => 1});
die "Unable to connect to database : $Mysql::db_errstr\n" unless $dbh;
$dbh->{'mysql_auto_reconnect'} = 1;

for (my $i = 0; $i < 1000; $i++) {
warn scalar localtime, " auto_reconnect = $dbh->{mysql_auto_reconnect}\n";
my $sql = qq{select nom from dinfo.sciper where sciper = '105640'};
my $sth = $dbh->prepare ($sql);
$sth->execute ();
my ($name) = $sth->fetchrow;
warn "name = $name\n";
sleep 10;
}

I launch this, restart the server between the first and second
iteration and gets this :

Wed Jul 15 15:23:00 2009 auto_reconnect = 1
name = LECOMMANDEUR
Wed Jul 15 15:23:10 2009 auto_reconnect = 1
DBD::mysql::db prepare failed: MySQL server has gone away at ./testdb1
line 15.
DBD::mysql::db prepare failed: MySQL server has gone away at ./testdb1
line 15.

Yes, twice.

Am I doing something wrong ?

Claude.

--
Claude Lecommandeur claude.lecommandeur@epfl.ch
EPFL - PL-DIT - KIS +41 21 6932297
1015 Lausanne (Switzerland) http://slpc1.epfl.ch/public/Claude.html

This signature intentionally left boring.


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org