Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DBI and return code after a failed connection 1

Status
Not open for further replies.

monrow

Technical User
Apr 22, 2008
29
FR
Hi,

I'm uising DBI and i will know, how can i do , to check if the connexion failed ?
I use this

my $dbh = DBI->connect("dbi:Oracle:$db", $user, $pass);

If my connection failed , i want to get the return code and print the connexion failed.
sommething like this

if ($code <> 0) then
{
print "connexion failed";
}

If i do a query :
my $sth=$dbh->prepare($query);
$sth->execute();

and the query failed because a problem of connexion,i want to get the error code or message , and print it.

Is it possible ???

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top