in reply to how to test a connection with mysql db
DBI->connect() will return undef if the connection failed, so you can call first one, then another on failure by,
You will want to avoid setting RaiseError or PrintError in the connect calls. Set those you want as soon as convenient after connecting.my $dbh = DBI->connect(@pref_args) || DBI->connect(@alt_args) or die $DBI::errstr;
Your error message suggests that your connection may be failing due to bad arguments. I'm not positive of that, but it's worth checking.
The $dbh->ping method is handy for checking if a connection is still alive, once made.
After Compline,
Zaxo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: how to test a connection with mysql db
by jZed (Prior) on Apr 15, 2005 at 22:02 UTC |