You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Andrew Dunstan <an...@writeme.com> on 2000/06/20 15:26:32 UTC

DBI connect_cached vs Apache::DBI

The DBI manpage says this:

connect_cached is like connect, except that the database handle returned is
also stored in a hash associated with the given parameters. If another call
is made to connect_cached with the same parameter values, then the
corresponding cached $dbh will be returned if it is still valid. The cached
database handle is replaced with a new connection if it has been
disconnected or if the ping method fails.

Note that the behavior of this method differs in several respects from the
behavior of presistent (sic) connections implemented by Apache::DBI.

What are the differences?

cheers

andrew


Re: DBI connect_cached vs Apache::DBI

Posted by John M Vinopal <jv...@abattoir.com>.
connect_cached() does not ignore disconnect().  A disconnect() will remove 
the dbh from the cache.  I ran into odd problems using both (a mistake at the
time) connect_cached() and Apache::DBI under mod_perl.

-j

On Tue, Jun 20, 2000 at 11:22:48AM -0700, Perrin Harkins wrote:
> On Tue, 20 Jun 2000, Andrew Dunstan wrote:
> > What are the differences?
> Apache::DBI uses a cleanup handler to rollback any uncomitted transactions
> after each request.  It is also transparent, i.e. you can use normal
> connect statements and turn the persistence on or off by putting in
> Apache::DBI or not.
> 
> There are probably other differences that I'm not aware of.
> 
> - Perrin

Re: DBI connect_cached vs Apache::DBI

Posted by Perrin Harkins <pe...@primenet.com>.
On Tue, 20 Jun 2000, Andrew Dunstan wrote:

> 
> The DBI manpage says this:
> 
> connect_cached is like connect, except that the database handle returned is
> also stored in a hash associated with the given parameters. If another call
> is made to connect_cached with the same parameter values, then the
> corresponding cached $dbh will be returned if it is still valid. The cached
> database handle is replaced with a new connection if it has been
> disconnected or if the ping method fails.
> 
> Note that the behavior of this method differs in several respects from the
> behavior of presistent (sic) connections implemented by Apache::DBI.
> 
> What are the differences?

Apache::DBI uses a cleanup handler to rollback any uncomitted transactions
after each request.  It is also transparent, i.e. you can use normal
connect statements and turn the persistence on or off by putting in
Apache::DBI or not.

There are probably other differences that I'm not aware of.

- Perrin