in reply to Re: Re: accessing Apache::DBI 'cached connections'
in thread accessing Apache::DBI 'cached connections'

Apache::DBI works transparently, so if one scripts works, and the other doesn't, then there must be differences in the way you connect in the two scripts. In other words a script that works without Apache::DBI must also work with Apache::DBI!

Try the following bit of code and see what you get...

#!/usr/bin/perl use CGI qw/:standard/; use DBI; use Data::Dumper; $Apache::DBI::DEBUG = 2; # Turn on Apache::DBI debugging print header, start_html('Testing Apache::DBI'), h1('Testing Apache::DBI'); my $dbh; eval { $dbh = DBI->connect( "DBI:mysql:database=test;host=localhost", undef +, undef, { RaiseError => 1 } ) ; }; if ($@) { print p('DBI Error: '.$@); } else { print p('Connect success'); print p("We are using Apache::DBI") if $dbh->isa('Apache::DBI::db'); print pre(Dumper($dbh)); } print end_html();

When I call that with Apache::DBI enabled, I get the following:

Testing Apache::DBI

Connect success

We are using Apache::DBI

$VAR1 = bless( {}, 'Apache::DBI::db' );

And in my error log I get:

13692 Apache::DBI need ping: yes
13692 Apache::DBI new connect to 'database=test;host=localhostAutoCommit=1PrintError=1RaiseError=1'

Cheers,

Cees

Update: Looks like this got solved while I was writing my test script. I guess I'll have to be quicker next time...