[cgiapp] cached DBI connections with cgiapp/fastcgi
Perrin Harkins
perrin at elem.com
Wed Oct 22 13:48:27 EDT 2008
On Wed, Oct 22, 2008 at 1:33 PM, Benjamin Hitz <hitz at genome.stanford.edu> wrote:
> It basically calls DBI->connect_cached("dbi:Oracle:sdev2", $user, $pass, {
> RaiseError=>1, AutoCommit=>0, private_cachekey => $0 });
That ought to work. The connect_cached call should ping the
connection and reconnect if it's stale. You might want to turn on
DBI_TRACE to figure out why it isn't doing that. This used to be
referred to as "the morning bug" on the mod_perl list and usually
happened with DBD drivers that lie about ping (return true when the
handle is not really connected).
Incidentally, I hope you have something in there to catch errors at
the top level of your FastCGI adapter and issue a rollback on any open
database handles. If you don't, you might leave some partially
completed uncommitted data around that the next request would commit.
Aoache::DBI solves this for mod_perl by doing a rollback on all open
connections after every request, in case the request exited
abnormally.
- Perrin
More information about the cgiapp
mailing list