my $sth = $dbh->prepare('SELECT * FROM dual'); my $rows = $sth->execute(); if ($rows != 1) { # try to reconnect }