in reply to How to check the $dbh's status
#Connection to the database
my $user="test_user";
my $pw="pass123";
print "starting the process";
$dbh = DBI->connect('DBI:ODBC:TESTSERVER',$user,$pw);
if(!$dbh){
print "Unable to connect to the database testserver\n";
exit(0);
}
else{
print "connected \n";
}
#Interacting with the database
$sth=$dbh->prepare("select * from table1") ||
die "prepare failed";
$sth->execute() || die "execute failed";
while (my @rows= $sth->fetchrow_array)
{
print "@rows";
}
#Disconnecting from the database
$dbh->disconnect;