I have Perl processes that update multiple dBs using Win32::ODBC than run 24/7. I ran into problems with some dB servers not being available because of maintence or other reasons. I wrote a package that connects to the dB(s) and stored the connection information. I have a sub that executes the query and if I get (Win32::ODBC::Error() =~ /Communication link failure/) after execution then another connection to the dB is made and the query executes again. It's something like this.
my ($rc) = $sql_obj->sql($query); return ($sql_obj, undef) unless $rc; return ($sql_obj, "".Win32::ODBC::Error()) unless (Win32::ODBC::Error +() =~ /Communication link failure/); my($sql_obj) = $self->connect($server, $user, $password); return (undef, "Cannot reconnect") unless ($new_sql_obj); $rc=$sql_obj->sql($query); return ($sql_obj, "".$rc) if ($rc); return ($sql_obj, undef);

In reply to Re: Timeout problems with DBI by monktim
in thread Timeout problems with DBI by guha

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.