perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Max Pinton <>
Subject DBI and Apache::DBI issues
Date Sun, 06 Feb 2011 03:01:50 GMT
Hello mod_perlers,

I recently updated my server, which was running Debian Sarge, and  
migrated from mod_perl 1 to 2, among many other upgrades. It wasn't a  
smooth process, but I suppose skipping three major OS versions I  
shouldn't have expected it to be.

But the issue I'm asking about today is with DBI (1.612) and  
Apache::DBI (1.08). In my old configuration they worked fine, but  
after the upgrade I started seeing tons of errors like this:

DBD::mysql::st execute failed: Commands out of sync; you can't run  
this command now
DBD::mysql::st fetchrow_hashref failed: fetch() without execute()
Can't set DBI::st=HASH(0xba5fc640)->{NAME}: unrecognised attribute  
name or invalid value
Can't call method "get" on an undefined value
DBD::mysql::st execute failed: Lost connection to MySQL server during  
DBD driver has not implemented the AutoCommit attribute

So I removed Apache::DBI from my startup.perl, which almost fixed it.  
But not quite. I would still get occasional errors like this:

DBD::mysql::st fetchrow_hashref failed: fetch() without execute()

One sort of oddball thing I'm doing is using a convenience wrapper  
that looks like this:

package My::DBI;
use DBI;
sub connect {
	my $class = shift;
	DBI->connect($dsn, $user, $dbpw, @_);

And then elsewhere doing this:

package My::Foo;
use My::DBI;
my $dbh = My::DBI->connect;
sub new {
	my $sth = $dbh->...

Thinking that the problem was that $dbh was having some weird scope  
issue, I moved all the connect calls into the subs that use them. This  
seems to have solved the second batch of errors, but when I re-enable  
Apache::DBI, it starts generating tons of the first kind of errors,  
particularly "Commands out of sync."

I've Googled these errors and haven't found anything that seems  

I appreciate any help. Thanks.


Max Pinton,
Design your own card at

View raw message