Apache-DBI
view release on metacpan or search on metacpan
make test # only works with MySQL so far; patches welcome
make install
IF YOU HAVE PROBLEMS:
---------------------
Please read the README and the the module documentation: 'perldoc Apache::AuthDBI',
'perldoc Apache::DBI'.
Please verify your setup: turn on debug output and compare it to traces.txt.
If you have problems with persistent database connections, verify that everything
works correct without using Apache::DBI.
Before sending a bug report it might be useful to look at the debug output.
To enable full debug output set the following variables in startup.pl or in your
perl script:
$Apache::DBI::DEBUG = 2;
$Apache::AuthDBI::DEBUG = 2;
and watch the error_log. Compare the output to the traces in traces.txt.
lib/Apache/DBI.pm view on Meta::CPAN
my $now = time;
# Must ping if TimeOut = 0 else base on time
my $needping = ($PingTimeOut{$dsn} == 0 or
($PingTimeOut{$dsn} > 0 and
$now - $LastPingTime{$dsn} > $PingTimeOut{$dsn})
) ? 1 : 0;
debug(2, "$prefix need ping: " . ($needping == 1 ? "yes" : "no"));
$LastPingTime{$dsn} = $now;
# check first if there is already a database-handle cached
# if this is the case, possibly verify the database-handle
# using the ping-method. Use eval for checking the connection
# handle in order to avoid problems (dying inside ping) when
# RaiseError being on and the handle is invalid.
if ($Connected{$Idx} and (!$needping or eval{$Connected{$Idx}->ping})) {
debug(2, "$prefix already connected to '$Idx'");
# Force clean up of handle in case previous transaction failed to
# clean up the handle
&reset_startup_state($Idx);
1.3. PerlChildInitHandler: check if a pre-configured connection in startup.pl is initiated.
the following entries are supposed to appear in the error_log once for every server:
1033 Apache::DBI PerlChildInitHandler
1033 Apache::DBI need ping: yes
1033 Apache::DBI new connect to 'dbname=template1{httpd{www{AutoCommit=1{PrintError=1'
1.4. timeout for ping: set PingTimeOut > 0 and verify, that the first database access shows
'need ping: yes' (unless a database handle has been created upon server startup).
The second access immediately afterwards shows 'need ping: no' and the third access after
timeout seconds again shows 'need ping: yes'. Always watch the same server !
De-activate ping with setting timeout = -1 and check for 'need ping: no'.
1.5. After having initiated a persistent connection check the perl-status menu-item
'DBI connections' ( http://localhost/perl-status?DBI ). Be sure, to check a server,
which has a database handle !
( run in 0.530 second using v1.01-cache-2.11-cpan-5467b0d2c73 )