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

I am really getting beat up with trying to Perl to connect to an Access Database. I will switching later either to SQL Server or Oracle, so I guess I need to connect via DBI:ODBC. That is where the problem came to light....I receive this error: Can not locate object method "connect" via package "DBI" (perhaps you forgot to load DBI). At this point the code is pretty simple...but still does not work!!

Any Ideas would be greatly appreciated!!!
Code Snippet:
use DBI;
my $dsn = "driver=Microsoft Access Driver
(*.mdb);dbq=\\\\server\\xxx\\xxx.mdb";

my $dbh = DBI->connect("DBI:ODBC:$dsn") ||
print "
Error Opening Database:
$DBI::errstr\n";

my $sth = $dbh->prepare("SELECT * FROM Schedule") ||
print "Error in Prepare: $DBI::errstr\n";

$sth->execute() ||
print "
Error: $DBI::errstr\n";

Replies are listed 'Best First'.
Re: DBI:ODBC - Error
by lachoy (Parson) on May 14, 2002 at 18:01 UTC

    I don't think you have DBI installed. If you're using PPM, try:

    > ppm PPM> install DBI ... PPM> install DBD-ODBC

    then try and see what happens. If you still have questions, browse the many nodes about DBI here.