Apache::DBI 0.94 - connect_on_init broken?

[prev] [thread] [next] [Date index for 2004/12/15]

From: Joshua Hoblitt
Subject: Apache::DBI 0.94 - connect_on_init broken?
Date: 03:12 on 15 Dec 2004
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

Apache::DBI 0.94 - connect_on_init broken?
Joshua Hoblitt 03:12 on 15 Dec 2004

Re: Apache::DBI 0.94 - connect_on_init broken?
Joshua Hoblitt 03:52 on 15 Dec 2004

Re: Apache::DBI 0.94 - connect_on_init broken?
Larry Leszczynski 20:42 on 16 Dec 2004

Generated at 11:26 on 21 Dec 2004 by mariachi v0.52