DBD mysql loosing connection and failing to reconnect



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





Relevant Pages

  • Re: hitting the limits
    ... relatively straight forward MySql database. ... 10K visitors a month and an 80Mb database are nothing. ... heavily loaded server. ... But the connection will hang around until the garbage ...
    (comp.lang.php)
  • Re: VFP8 & MySQL
    ... > VFP functions like NVL to a MySQL one, definitely it made the switch very ... > About your connection problem, I have mine setup as default for 100 ... As for the server, we left it ... The server crashed and corrupted the database. ...
    (microsoft.public.fox.programmer.exchange)
  • Re: VFP8 & MySQL
    ... Main Location and 3 branches (these are remotely accessing MySQL at the main ... About your connection problem, I have mine setup as default for 100 ... As for the server, we left it alone. ... The server crashed and corrupted the database. ...
    (microsoft.public.fox.programmer.exchange)
  • Re: Java and MySql program example ?
    ... > I am trying to learn Java and need an example program with MySql ... > MySql database. ... Database connection established ...
    (comp.lang.java.programmer)
  • Re: OdbcDataReader
    ... I did as you told and i find out that the connection to the MySql ... database closes and if i go to the MySql mamager i not able to open it ... >> While the odbccommand is reading the Access table I open the other ...
    (microsoft.public.dotnet.languages.csharp)