Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

DBI error under mod_perl

by mboudreau (Novice)
on Feb 07, 2009 at 02:18 UTC ( #742061=perlquestion: print w/ replies, xml ) Need Help??
mboudreau has asked for the wisdom of the Perl Monks concerning the following question:

Salvete omnes!

I'm trying to connect to a MySQL database. The connection works in a Perl script I run on the command line, but it fails in an HTML::Mason page executed by mod_perl.

I'm on Mac OS X 10.5.6, Perl 5.8.8, mod_perl 2.0.4, MySQL 5.0.45, DBI 1.607, DBD::mysql 4.010. Here's the code:

use DBI; my $dbsrc = 'DBI:mysql:test:localhost'; my %attr = ( PrintError => 0, RaiseError => 0 ); my $dbh = DBI->connect($dbsrc, 'mboudreau', 'secret', \%attr) or die " +$DBI::err str"; $dbh->disconnect;

and here's the error message I get:

Can't locate auto/DBI/connect.al in @INC (@INC contains: /System/Library/Perl/5.8.8/darwin-thread-multi-2level /System/Library/Perl/5.8.8 /Library/Perl/5.8.8/darwin-thread-multi-2level /Library/Perl/5.8.8 /Library/Perl /Network/Library/Perl/5.8.8/darwin-thread-multi-2level /Network/Library/Perl/5.8.8 /Network/Library/Perl /System/Library/Perl/Extras/5.8.8/darwin-thread-multi-2level /System/Library/Perl/Extras/5.8.8 /Library/Perl/5.8.6/darwin-thread-multi-2level /Library/Perl/5.8.6 /Library/Perl/5.8.1 . /usr) at /Users/mrb/Sites/mason_mysql_test.mhtml line 17

I've searched my computer (sudo find / -name connect.al -print) for 'connect.al' and it's nowhere to be found. I've reinstalled DBI and DBD::mysql, no errors, no luck. Googling for this error message turns up a lot of people who had typos in their connection statement, but I don't think that's the case here (identical code works fine in a command-line script). Any guidance?

Comment on DBI error under mod_perl
Select or Download Code
Replies are listed 'Best First'.
Re: DBI error under mod_perl
by perrin (Chancellor) on Feb 07, 2009 at 03:27 UTC
    This probably means that your mod_perl was compiled against a different perl binary than the one you have now. Recompile mod_perl.

      While running 'make test' on mod_perl, I got test failures accompanied by more error messages about the missing DBI/connect.al. So I reinstalled DBI from scratch, restarted Apache, and now everything works. I could have sworn there were no errors when I reinstalled DBI prior to recompiling mod_perl, but perhaps I missed something.

      What puzzles me is that, now that things are working, I still don't find 'connect.al' anywhere on my computer, though apparently Perl has stopped asking for it. What should I learn from that?

        Ok, I guess your DBI was not compiled against the same perl as mod_perl. This can happen if Apple updates the system perl. On a production system, you either have to avoid system updates that will update perl or just install a separate perl for your use and leave the system one to Apple.

        My guess is that DBI could not use the database driver you had in your connection string so attempted to use a generic driver.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://742061]
Approved by planetscape
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2015-09-02 10:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred temperature scale is:










    Results (75 votes), past polls