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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.