Beefy Boxes and Bandwidth Generously Provided by pair Networks Russ
Don't ask to ask, just ask
 
PerlMonks  

Re: mysql_auto_reconnect

by idle (Friar)
on Jan 27, 2006 at 07:38 UTC ( [id://525961]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to mysql_auto_reconnect

You can check your connection with attribute {Active}.
my $h=$dbh->{Active}; &reconnect if (!$h);

Replies are listed 'Best First'.
Re^2: mysql_auto_reconnect
by BMaximus (Chaplain) on Jan 27, 2006 at 11:13 UTC
    This is not for checking to see if a connection is still active. In fact you won't get anything from this if you use the connection handler. What idle used is to see if the statement handler is still active after execute() is called on it. If you want to check if the connection to the database is still active then you use the $dbh->ping() method.

    if ($dbh->ping()) { $sth = $dbh->prepare('SELECT ...'); $sth->execute(); ... } else { $dbh = DBI::connect(...); }


    BMaximus

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://525961]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.