Apache::DBI and DBD::mysql ping not working

Daniel Manley <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
Hi,

I've been digging around in my mod_perl-based apps and trying to figure 
out why setting up the DB connections for pinging is still randomly 
producing first-thing-in-the-morning "mysql server has gone away" 
errors.  I read up about the morning bug and such (adding ping() to 
mysql.pm based on examples on the net) and still can't get it working.  
I'm using apache 2.2.17 and mod_perl 2.0.4.

so - I finally started digging into the Apache::DBI, DBD::mysql and 
DBD::Oracle packages -- I put in warn messages all over the place and 
turned on various debugs.  I see my debug messages from Oracle's ping 
call in the apache error log.  But I can never get the mysql ping to 
show its warn messages.  not via Apache::DBI's calls to it or my own 
forced ping call on the dbh.  So I can only conclude that it's not 
getting to the ping() method in DBD/mysql.pm

any idea where the mysql ping happens or why it's not?  is the top-level 
DBI package interfering?

(inserted right after the prepare method in the DBD::mysql::db package 
section)

sub ping {
      my ($dbh) = @_;
      my $ret = 0;
warn "DANDAN:  mysql ping!!";
      eval {
        local $SIG{__DIE__}  = sub { return (0); };
        local $SIG{__WARN__} = sub { return (0); };
        # adapt the select statement to your database:
        $ret = $dbh->do('select 1');
warn "DANDAN: selected 1";
      };
      return ($@) ? 0 : $ret;
}

similar warn messages in DBD::Oracle's ping show up just fine in Apache 
error log.

Dan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.