I don't know if the Sybase driver supports it, but flaky servers suggest the DBI $dbh->ping method. You can open a handle to each server, say $dbx and $dby, and use the trinary op to select my $sth = ($dbx->ping ? $dbx : $dby)->prepare('select 1+1'); and so on. That will get awkward fast.
Another approach is to first try to connect to x. If that fails, connect to y. That isn't what you want for a long running process, but for a one-shot script it is probably ok (you wanted tolerant, not immune, right?)
In any case, you should be meticulous about error checking with each DBI call.my $dbh = connect($x_string, $x_nam, $x_pass) || connect($y_string, $y_nam, $y_pass) or die 'No db!';
After Compline,
Zaxo
In reply to Re: Connecting to Multiple Databases
by Zaxo
in thread Connecting to Multiple Databases
by antonybr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |