Disabling Apache::DBI
am 21.10.2005 18:57:19 von ted.behling
I have multiple mod_perl applications running within one Apache =
instance. For most of these applications, I want to use Apache::DBI, =
but I want to disable it for just one. According to various Web pages, =
this is not possible, because Apache::DBI attaches itself to all =
DBI->connect() calls. I would have to run my app in a separate Apache =
instance that excludes Apache::DBI.
It looks like it actually is possible to disable Apache::DBI. =
Apache::DBI will not be used for a specific DBI connection if its =
DBI->connect() has a special value set for the dbi_connect_method =
attribute, as in:
$dbh =3D DBI->connect('dbi:...', '...', '...', { dbi_connect_method =
=3D> 'connect' } );
Could somebody verify that this is a sane and future-proof approach?
From my reading of the DBI.pm source code, this works because DBI =
defaults to using its own connect() method, then switches to =
Apache::DBI::connect() if Apache::DBI is in use, and finally, looks for =
the "dbi_connect_method" attribute. By setting this attribute to the =
original default, "connect", Apache::DBI is neatly bypassed.
This would be more elegant if a future version of DBI were to include =
support for a "disable_apache_dbi" attribute. I think this might =
involve just a simple addition to DBI::connect().
Ted Behling, ISP Systems Analyst
Hargray Communications
ted.behling@htc.hargray.com
Re: Disabling Apache::DBI
am 21.10.2005 21:49:59 von Tim.Bunce
On Fri, Oct 21, 2005 at 12:57:19PM -0400, Ted Behling wrote:
> I have multiple mod_perl applications running within one Apache instance. For most of these applications, I want to use Apache::DBI, but I want to disable it for just one. According to various Web pages, this is not possible, because Apache::DBI attaches itself to all DBI->connect() calls. I would have to run my app in a separate Apache instance that excludes Apache::DBI.
>
> It looks like it actually is possible to disable Apache::DBI. Apache::DBI will not be used for a specific DBI connection if its DBI->connect() has a special value set for the dbi_connect_method attribute, as in:
>
> $dbh = DBI->connect('dbi:...', '...', '...', { dbi_connect_method => 'connect' } );
>
> Could somebody verify that this is a sane and future-proof approach?
Send me a patch to document it and that'll make it sane and future-proof :)
Tim.
> >From my reading of the DBI.pm source code, this works because DBI
> >defaults to using its own connect() method, then switches to
> >Apache::DBI::connect() if Apache::DBI is in use, and finally, looks
> >for the "dbi_connect_method" attribute. By setting this attribute to
> >the original default, "connect", Apache::DBI is neatly bypassed.
>
> This would be more elegant if a future version of DBI were to include
> support for a "disable_apache_dbi" attribute. I think this might
> involve just a simple addition to DBI::connect().
Re: Disabling Apache::DBI
am 27.10.2005 07:31:57 von pgollucci
Ted Behling wrote:
> Could somebody verify that this is a sane and future-proof approach?
I can't speak about the future of DBI, but your reading of the current source
code is correct.
--
END
------------------------------------------------------------
What doesn't kill us can only make us stronger.
Nothing is impossible.
Philip M. Gollucci (pgollucci@p6m7g8.com) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
http://www.liquidityservicesinc.com
http://www.liquidation.com
http://www.uksurplus.com
http://www.govliquidation.com
http://www.gowholesale.com