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

Re: DBI AutoCommit goes away when db connection is killed


Lev Lvovsky wrote:
Once you reconnect, the connection is persistent again. At least, that's been my experience with postgresql.

This is exactly what I've been thinking to do, but I've not seen anything within Apache::DBI that allows me to reconnect per se. How do I perform that action?

Also, forgive this question if it seems a little obtuse, but in the startup.pl file, I do something like this:

Apache::DBI->connect_on_init(...)


My experience with Apache::DBI has been that it needs no special setup.

All I've ever done is:

my $dbh;
$cnt = 0;
while(!$dbh) {
  eval {
    $dbh = DBI->connect(....);
  };
  if($@) {
    warn("DB Down: $@");
    sleep 5;
    $cnt++;
  }
  last if $cnt > 3;
}

unless($dbh) {
  # show user an error page
}

Rob


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.