On Mar 29, 2007, at 1:01 PM, Perrin Harkins wrote:

Apache::DBI handles this for you.  It checks if you are connection
during startup and does not make your connection persistent if you
are.

is this new-ish ( like within a year or so ?)

it used to not do that. perhaps by bug not design, but I had to get very aggressive ~2004/2005 to keep connections from caching.

The problem here is that Helmut is caching the database handle
himself, instead of calling DBI->connect on each request and letting
Apache::DBI cache it.  That foils Apache::DBI's attempts to prevent
connections made in the parent from persisting.
agreed.

Caching database handles in your own object that persists across
requests is usually a bad idea.  It means that the things Apache::DBI
tries to do for you (like ping'ing the connection to see if it's still
good, and issuing a rollback after the request in case your code died
during a transaction) will not happen.  Don't do it unless you have a
solid understanding of the problems Apache::DBI addresses and a plan
for how to handle them yourself.
agreed.


Reply via email to