> -----Original Message-----
> From: Jim Serio [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 03, 2000 10:02 AM
> To: [EMAIL PROTECTED]
> Subject: Apache::DBI
>
>
> I'm not sure if this is even a problem but it's always
> been on my mind. I use Apache::DBI and I have a general
> module that handles db connections for my scripts. Here's
> the relevant portion:
>
> my $DBH ||= DBI->connect("...")
>
> It basically accepts a hash ref to the dbconfig and opens
> a connection. My httpd.conf is set with 5 spare clients
> MIN and 10 MAX.
>
> I'm the only one using this module right now and starting
> httpd fresh results in no conections. Running my test CGI
> script once results in two (2) mysql connections. Running
> it again, results in four (4) connections. This will
> eventually continue until the number of mysql connections
> is always four (4) more than httpd processes.
>
> The thing that I can't figure out is that my scripts
> properly open and close the db connection, so why doesn't
> Apache::DBI re-use the original connection? Why spawn
> one more each time?
try setting $Apache::DBI::DEBUG=2 to debug your connections.
any call to $dbh->disconnect is intercepted by Apache::DBI, thus no
disconnect ever really happens (which is the whole point to Apache::DBI)
Keep in mind that Apache::DBI will hold one connection per httpd child
process _per connect string_. That is, if you connect once with,say,
RAISE_ERROR=1 and once with RAISE_ERROR=0, Apache::DBI will create two
processes for that child.
HTH
--Geoff
>
> I've checked the FAQ and searched the archives and found
> no info (other than someone else asking this same question
> last year with no helpful answer) and the Apache:DBI man
> page doesn't touch on this.
>
> Jim
>