[Dbix-class] Apache::DBI and DBIx::Class

Mark Hedges hedges at ucsd.edu
Wed Apr 5 03:39:46 CEST 2006



On Tue, 4 Apr 2006, Mark Hedges wrote:
> >
> > If you're running in a true Apache handler, go ahead and
> > reconnect to the database for every request.  If the connection
> > is still live, Apache::DBI will just do a ping and doesn't need
> > to reconnect.  With the above settings it will only happen if
> 
> I was just thinking I'm not sure if this makes sense given that 
> you're using DBIC.  You shouldn't have to explicitly connect at 
> all.  It should Just Work... any time DBIC makes a call to DBI 
> it should be intercepted magically by Apache::DBI.


Sorry about the back and forth, I like to talk to myself.

Now that I read some messages from the February archive and 
realize how complex the internals are, I'm concerned too because 
I'm about to deploy a modperl project using DBIx::Class.

In Doran Barton's message, he says he's in an Apache handler.
In some of Brandon Black's messages about Apache::DBI fixes in 
February, Brandon says something about "the process is dying 
anyway."  Except in an Apache handler, the process doesn't die, 
and mod_perl has some habits of caching objects to be re-used.  

Sometimes with other objects I find I have to set them to undef 
and then re-initialize them if I really really want a new copy.  
I don't know if that's relevant to DBIx::Class in terms of 
making it reconnect, if it doesn't know that it should have 
"disconnected" 10 seconds ago when the request cycle ended, but 
the object is still around, however the database connection has 
gone idle and timed out.  When it's used again, will it try to 
get information from a dead DBIC internal handle without 
reconnecting it?

Mark



More information about the Dbix-class mailing list