in reply to Re: DBI and Database Failover?
in thread DBI and Database Failover?

Thank you everyone for your replies so far!

It's a connect or die situation. Here is the code:

$fromDBH = DBI->connect("DBI:DB2:$fromDB", $username, $password, {Auto +Commit => 0}) or closing('ReportAgg.pl', "Couldn't connect to $fromDB :\n\n" . D +BI->errstr, FALSE, $fromSTH, $fromDBH, $toSTH, $toDBH);
the closing subroutine has a little more logging and then dies from the script.

One thing I failed to mention that might help is that we're using WebSphere for our application server and that handles the HADR failover nicely. Nothing needs to be tweaked there.

The Perl part of it is for various cronjobs that we run. There are probably around 20 Perl cronjobs that use the database that would be affected by the database failing. Using the code above, it just connects to the database name that is cataloged on that server. So if it's no there it's going to fail bigtime. It has no knowledge of the secondary db. So as far as what JavaFan is saying, that sure would be nice to have the IPs switched automatically, but it appears as if that is not the case here.