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

In reply to Re^2: mysql_auto_reconnect by BMaximus
in thread mysql_auto_reconnect by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":