After some experimentation, it seems that if I use load Apache::DBI while using
my own PerlChildInitHandler that indeed database connection that time out do
get reconnected (as expected). I'm still at a loss as to why 'connect_on_init'
does not work for me.
Cheers,
-J
--
On Tue, 14 Dec 2004, Joshua Hoblitt wrote:
Hi Folks,
This is my first serious attempt at working with mod_perl so please excuse me
if this e-mail is a little naive.
I have a SOAP::Transport::HTTP::Apache application that makes fairly heavy
use
of DBI. I would like to use Apache::DBI so I don't have to write my own
logic
for keep alives and reconnecting broken database handles. Unfortunately, the
connect_on_init method does not seem to work for me.
When I place this snippet in my Apache configuration my database (MySQL)
reports that no database threads have been spawned.
--
PerlModule DBI
PerlModule Apache::DBI
.
.
<perl>
Apache::DBI->connect_on_init(
"DBI:mysql:database=foo:host=localhost",
"foo",
"foo",
);
</perl>
--
When I replace that with:
--
PerlModule My::Foo
.
.
<perl>
Apache->push_handlers(PerlChildInitHandler => sub {
My::Foo->setup(
"DBI:mysql:database=foo:host=localhost",
"foo",
"foo",
;
}
);
</perl>
--
Where ->setup is creating a database handle and storing it in a package
variable. The database reports 64 threads (the number of Apache children at
startup) active on the database. This has left me completely puzzled as
Apache::DBI is also installing a PerChildInitHandler.
I'm running this with Perl 5.8.5 on Apache 1.3.33/mod_perl 1.29.
Any advice would be much appreciated.
Cheers,
-J
--
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html