On Tue, Nov 11, 2008 at 11:27:59AM -0500, Patrick Galbraith wrote:
> John,
>
> Hi! DBD::mysql uses mysql_auto_reconnect to connect back to MySQL if the 
> connection drops
>
> $dbh= DBI->connect('DBI:mysql:test:mysql_auto_reconnect=1', $foo, $fee)...;
>
> or of course
>
> $dbh->{mysql_auto_reconnect};
>
> In the perl side of the driver:
>
> if ($this && ($ENV{MOD_PERL} || $ENV{GATEWAY_INTERFACE})) {
>        $this->{mysql_auto_reconnect} = 1;
>    }
>
> I had this off once with a release I did, and a lot of people were very 
> unhappy ;)

I hope they all appreciate the risks they're taking if they use locks
or any other server state that would be silently lost by an auto reconnect.

> So, whatever might give the functionality to reconnect automatically
> I suppose it'd be the same as doing
>
> unless ($dbh->ping) {
>    $dbh= .... connect ...
> }

The DBI spells that DBI->connect_cached(...)

Tim.

Reply via email to