You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by David Lloyd <ll...@rebel.net.au> on 2001/09/05 04:01:43 UTC

Apache::DBI (OT Kinda) Question

If I use Apache::DBI under mod_perl and continuosly open and disconnect
a DBI:mysql connection, it should reuse the same connection and not
perform a database lookup all the time.

I have a piece of code that I can't be bothered optimising (i.e. it
currently opens and closes about 30 connections before finishing and
recoding it would be a Pain In The Arse [PITA]).

DSL
-- 
Pussy's good for six at the most
 (Mrs. Lovett, Sweeney Todd)

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Apache::DBI (OT Kinda) Question

Posted by Aaron Johnson <so...@gina.net>.
You can verify correct operation of Apache::DBI by doing the following:

1) Make sure it appears BEFORE the DBI load in your startup.pl (or
equivalent)
2) Use Apache::Status and enable perl-status as needed in your httpd.conf
load in this order:

use Apache::Status();
use Apache::DBI();
use DBI();

3) Pull the URL that should use the presistent connection and then check
the status of the DBI connections via the perl-status default page.

If you don't see any connections after calling that page then the database
connection is NOT being reused.

Aaron Johnson

David Lloyd wrote:

> If I use Apache::DBI under mod_perl and continuosly open and disconnect
> a DBI:mysql connection, it should reuse the same connection and not
> perform a database lookup all the time.
>
> I have a piece of code that I can't be bothered optimising (i.e. it
> currently opens and closes about 30 connections before finishing and
> recoding it would be a Pain In The Arse [PITA]).
>
> DSL
> --
> Pussy's good for six at the most
>  (Mrs. Lovett, Sweeney Todd)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Apache::DBI (OT Kinda) Question

Posted by Angus Lees <gu...@switchonline.com.au>.
On Wed, Sep 05, 2001 at 11:31:43AM +0930, David Lloyd wrote:
> If I use Apache::DBI under mod_perl and continuosly open and disconnect
> a DBI:mysql connection, it should reuse the same connection and not
> perform a database lookup all the time.

i presume your question is "..., right?"

yes it should, providing you keep connecting with the same dsn, user
and password (and the database connection is still ping()able).


if you use Apache::Status, you should be able to see the currently
cached database connections (for that one apache child) in
/perl-status (or wherever)

-- 
 - Gus

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org