perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Perrin Harkins <phark...@gmail.com>
Subject Re: Apache::DBI connect
Date Fri, 08 Nov 2013 15:41:36 GMT
On Thu, Nov 7, 2013 at 11:06 PM, Xinhuan Zheng <xzheng@christianbook.com>wrote:

> As I turned on more debugging, when the problem occurs, the Apache cached
> connection reference is different than the database handle reference the
> query is using.


Which query are you talking about?  The ping in Apache::DBI?  Or something
else in your own code?


> We use Apache::DBI and DBI and use Apache::DBI is before DBI. We actually
> call DBI->connect_cached and based on DBI document, I guess this would be
> handled by Apache::DBI connect.


Yes, it should be.


> However, I guess we also defined a base class that can store a database
> handle. There are subclasses inherited from this base class. Is that good
> idea to store a database handle in a base class?


No, don't do that.  You should pick one approach for managing database
handles, whether it's Apache::DBI or something else, and only use that.  If
you keep a database handle around in a global somewhere, it may time out
and nothing will ping it because you're not calling connect() on each
request.

- Perrin

Mime
View raw message