DBD mysql loosing connection and failing to reconnect

DBD mysql loosing connection and failing to reconnect

am 31.10.2005 06:01:51 von nigel.sweetman

------_=_NextPart_001_01C5DDD8.34B6D940
Content-Type: text/plain

Dear all,



I have Perl script that is supposed to reconnect after loosing
connection a MySQL database. For the life of me I can't see why it
won't reconnect. I am not a Perl programmer but the following should
tell the database to reconnect is connection is lost (DBD-Mysql 3.002
with DBI-1.48).



my $dbh = Mysql->connect("localhost", "database", "root", "");

$dbh->{'mysql_auto_reconnect'} = 1;

$dbh->{'AutoCommit'} = 1;

....

my $query = "SELECT id FROM users WHERE login = $username AND
password = $password AND webaccess = '1'";



MySQL timeouts are default at 8 hours for local and global, and it
does seem like there is no issue with the database itself, just the
handler. As a test I increased mysql timeout to a few days and forced
a legitimate disconnect, the script still wont reconnect.



Version Info:

MySQL 4.1.14 from latest ports on FreeBSD 5.4.



Has anyone had any experience with auto_reconnect, from what I can
see this should work. I would prefer not downgrading to a 1+ year old
version if I could.



Any help would be appreciated, Thanks!

Nigel




------_=_NextPart_001_01C5DDD8.34B6D940--