On Mar 29, 2007, at 9:27 AM, Kelvin Wu wrote:
1. Do I still need to use 'use Apache::DBI;' in my script (or in
startup.pl) if I already set 'PerlModule Apache::DBI' in httpd.conf?
2. Will Apache::DBI work (caches and manages connections etc) if I
dont change my CGI script DB calls but simply adding one line "use
Apache::DBI"?
someone who uses registry will have to comment.
3. How to limit DB connections from script? Or number of
connections simply equals to number of HTTPd?
number of connections = httpd children * number of unique connect
strings
if 2 connect strings are different -- same db/user/pass, but
different transaction setting , there will be 2 connections.
4. By setting $Apache::DBI::DEBUG = 2; Where output goes to?
it should go to STDERR, which is either the apache error log or the
vhost error log.
5. How many DB connections will be established by using Apache::DBI-
>connect_on_init()?
1 connection per unique connect string, per child
will make 1 connection per child
Apache::DBI->connect_on_init( 'abc' )
will make 2 connections per child
Apache::DBI->connect_on_init( 'abc' )
Apache::DBI->connect_on_init( 'abcd' )
multiply that by # of apache children
6. If I use Apache::DBI->connect_on_init() in startup.pl, will it
take care of DBI->connect() in my script? eg, DBI->connect() wont
actually create a new connection.
yes. it hijacks.
7. If I do NOT use Apache::DBI->connect_on_init() in startup.pl,
will Apache::DBI still manage DBI->connect() in my script? eg, wont
actually create a new connection if there is a free connection
created by ex-DBI->connect() call.
yes.
8. Will $dbh->disconnect() simply be ignored by using Apache::DBI
or, it will kill DB connection?
its ignored.
you need to do some fancy stuff to force a disconnect , if thats what
you want to do.