> -----Original Message-----
> From: Curtis Hawthorne [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 31, 2001 10:47 AM
> To: [EMAIL PROTECTED]
> Subject: Re: mod_perl/DBI problem
>
>
> Even when using Apache::DBI, I still have the same problem -
> If it times out
> once, it won't try again. I set Apache::DBI::DEBUG = 2, and
> here's the log:
>
> When I first load the page and get the timeout:
>
> 197345 Apache::DBI need ping: yes
> 197345 Apache::DBI new connect to
> 'DatabaseusernamepasswordPrintError=1RaiseError=1AutoCommit=1'
> [Tue Jul 31 09:31:45 2001] [error] DBI->connect(Database) failed:
> [Microsoft][ODBC SQL Server Driver]Timeout expired (SQL-S1T00)(DBD:
> db_login/SQLConnect err=-1) at DatabaseStuff.pm line 32
> Compilation failed in require at (eval 8) line 9.
> BEGIN failed--compilation aborted at (eval 8) line 9.
>
the way most people handle this is by separating out the connect routine,
wrapping it in an eval, and calling $r->child_terminate if $dbh is undef.
It's not ideal, but it takes that child out of the pool instead of having it
lingering with a bad connection for the next 5000 requests (or whatever your
MaxRequestPerChild is).
this is what I use for Oracle:
eval {
$dbh = DBI->connect($dbase, $user, $pass,
{RaiseError => 1, AutoCommit => 1, PrintError => 1});
};
if ($@) {
# if we could not log in, then there is the possibility under
# Apache::DBI that the child may never recover...
$r->server->log_error("Doh! We may have a TNS error: $DBI::errstr ",
"Scheduling child $$ termination NOW...");
$r->child_terminate;
}
HTH
--Geoff