tomazos has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to use DBI to access a MySQL database that is running on the same machine the script is running on...
use strict; use warnings; use DBI; my $dbh; $dbh = DBI->Connect("DBI:mysql:dbname:myhost.com","root","mypassword") + or die "Can't connect: $dbh->errstr\n"; $dbh->disconnect();

It fails at runtime with...

Can't locate auto/DBI/Connect.al in @INC (@INC contains: /usr/lib/perl5/i386-linux /usr/lib/perl5 /usr/lib/perl5/site_perl/i386-linux /usr/lib/perl5/site_perl /usr/lib/perl5/site_perl .) at testdb.pl line 8

Has anyone seen this before? I know that mysql is running and working as I can connect to it with the shell> mysql interface.

Any ideas?

Replies are listed 'Best First'.
Re: DBI - MySQL problem.
by wog (Curate) on Aug 31, 2001 at 06:19 UTC
    You are probably getting this error because it's DBI->connect and not DBI->Connect. Perl is case sensitive.
(Ovid) Re: DBI - MySQL problem.
by Ovid (Cardinal) on Aug 31, 2001 at 06:19 UTC
Re: DBI - MySQL problem.
by cLive ;-) (Prior) on Aug 31, 2001 at 11:03 UTC
    You need to use:
    $dbh = DBI->connect ... # not $dbh = DBI->Connect ... # or use $dbh = DBI->connect_cached ...
    ...if you will be making later connections...

    cLive ;-)

Re: DBI - MySQL problem.
by shotgunefx (Parson) on Aug 31, 2001 at 06:18 UTC
    Is the DBD::mysql driver installed?

    -Lee

    "To be civilized is to deny one's nature."
Re: DBI - MySQL problem.
by Zaxo (Archbishop) on Aug 31, 2001 at 06:18 UTC

    A load of nonsense

    Update: Oh, uh, yes, and the connect thing ;-)

    Update2: Grrr.. I seem to have been confused.

    After Compline,
    Zaxo