[CDBI] Re: Class-DBI on Apache/MS-Windows

Rod McChesney rod.mcchesney at gmail.com
Wed Mar 22 19:57:47 GMT 2006

On 3/22/06, Karjala <karjala_lists at karjala.org> wrote:
>  Thanks! That solved my problem.
>  If only, now, there were a way to tell Class::DBI::mysql to close the
> connection it opens when it does set_up_table, life would be easier.

We disconnect in the mod_perl parent process after loading schema
definitions. This is Oracle so ymmv, but we just call disconnect on
the main handle at the end of our parent startup script. Works just
fine. I tend to agree with Ed's point that in general this way lies
madness, and not just because of parent/child issues. Every unit test,
every standalone script that "use"s a Class:DBI class needs a database
connection just to load up, which is not a good thing. But it's
helpful in situation where the DBA wants to control what the apparent
schema is at runtime (has to do with a replication setup, don't ask).


>  Edward J. Sabol wrote:
>  I'm waiting for a CDBI person to answer me this question, if there
> is an answer.
>  I thought Perrin did a reasonably good job of responding to your original
> question already, but I'll take a shot.... Feel free to ignore my advice if
> you don't like it.
> In my opinion, you should just stop using set_up_table(). Define your
> columns
> and relationships explicitly using the standard CDBI methods. If you do
> that,
> then Apache won't try to connect to the database before initiating any
> threads and your problem is solved.
> I know a lot of people use set_up_table() or CDBI::Loader/AutoLoader and I
> suppose they can be useful if you're doing rapid prototyping and such, but I
> just think they are all more trouble than they're worth, *especially* in an
> Apache/mod_perl environment.
> Hope this helps,
> Ed

More information about the ClassDBI mailing list