[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Omaha.pm] Pulling data from a crappy MS-SQL server somewhere in Mexico...



It's nice to know that with enough retries and error handling, you can, eventually pull data from a bad server over a terrible network connection... :)

Perl in Omaha <-> DBI <-> DBD::Sybase <-> freetds <-> MS-SQL in Mexico

:)

j



  my $sth = $dbh_pms->prepare($strsql);
  for (1..50) {
     if ($sth->execute) {
        last;
     } else {
$logger->warn("Database error detected (attempt # $_). Waiting 3 seconds, then retrying: $DBI::errstr");
        $sth->finish;
        $sth = $dbh_pms->prepare($strsql);
        sleep 3;
     }
  }