Re: Weird Problems when using a Class::DBI subclass together with Apache::AuthCookie

[prev] [thread] [next] [Date index for 2004/08/23]

From: Perrin Harkins
Subject: Re: Weird Problems when using a Class::DBI subclass together with Apache::AuthCookie
Date: 21:10 on 23 Aug 2004
On Mon, 2004-08-23 at 16:51, William McKee wrote:
> There has been some discussion around this issue. I'm a bit vague on the
> details but from what I've seen cross the list, it's not a good idea to
> load your CDBI during startup. I just don't know whether directives in a
> virtualhost section are loaded just once at server start or for each
> child process.

Everything in the conf file is processed at startup.  You should not
open database connections at that point, or at least not persistent
ones.  If you have a recent DBI, and you are using Apache::DBI,
connect_cached will be handed off to Apache::DBI, which will not cache
connections during startup.  However, Ima::DBI seems to keep the
connections in closures, and even though it pings them before using them
I imagine that could be bad with some databases.  If it seems to be a
problem with yours, you could do something with a custom db_Main to
check if you are in Apache startup or not, or you could enhance Ima::DBI
to do this, or you could just have a custom db_Main that always calls
Apache::DBI and then turns the resulting handle into an Ima::DBI
database handle.

- Perrin

Re: Weird Problems when using a Class::DBI subclass together with Apache::AuthCookie
Perrin Harkins 21:10 on 23 Aug 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52