Hello,
I am having a ton of trouble trying to connect to an access database via ODBC with a perl job. I have an MS access database on my desktop that I have set up a System Datasource name of "Audit" with the path to the database. Then I used some code I found on the net to perform a simple SQL query:
#Windows-based Perl/DBI/MS Access example
use DBI;
#open connection to Access database
$dbh = DBI->connect('dbi:ODBC:driver=microsoft access driver (*.mdb);dbq=C:\Windows\Desktop\AuditTrail.mdb');
#prepare and execute SQL statement
$sqlstatement="SELECT PRODNO FROM tblCMFBridges";
$sth = $dbh->prepare($sqlstatement);
$sth->execute ||
die "Could not execute SQL statement ... maybe invalid?";
#output database results
while (@row=$sth->fetchrow_array)
{ print "@row\n" }
I continually get the following error:
C:\Perl2exe>perl audit2.txt
Can't locate loadable object for module DBI in @INC (@INC contains: C:/perl/lib
C:/perl/site/lib .) at C:/perl/lib/DBI.pm line 255
BEGIN failed--compilation aborted at C:/perl/lib/DBI.pm line 255.
Compilation failed in require at audit2.txt line 3.
BEGIN failed--compilation aborted at audit2.txt line 3.
I have loaded DBI.pm as well as ODBC.pm.
Any ideas???
Thanks for your help.
Tript.
I am having a ton of trouble trying to connect to an access database via ODBC with a perl job. I have an MS access database on my desktop that I have set up a System Datasource name of "Audit" with the path to the database. Then I used some code I found on the net to perform a simple SQL query:
#Windows-based Perl/DBI/MS Access example
use DBI;
#open connection to Access database
$dbh = DBI->connect('dbi:ODBC:driver=microsoft access driver (*.mdb);dbq=C:\Windows\Desktop\AuditTrail.mdb');
#prepare and execute SQL statement
$sqlstatement="SELECT PRODNO FROM tblCMFBridges";
$sth = $dbh->prepare($sqlstatement);
$sth->execute ||
die "Could not execute SQL statement ... maybe invalid?";
#output database results
while (@row=$sth->fetchrow_array)
{ print "@row\n" }
I continually get the following error:
C:\Perl2exe>perl audit2.txt
Can't locate loadable object for module DBI in @INC (@INC contains: C:/perl/lib
C:/perl/site/lib .) at C:/perl/lib/DBI.pm line 255
BEGIN failed--compilation aborted at C:/perl/lib/DBI.pm line 255.
Compilation failed in require at audit2.txt line 3.
BEGIN failed--compilation aborted at audit2.txt line 3.
I have loaded DBI.pm as well as ODBC.pm.
Any ideas???
Thanks for your help.
Tript.