Search code examples
perlms-access-2007

Does 64 bit perl includes all 32 bit perl modules?


I've got 64-bit operating system on which I have installed 64-bit perl. I've been given a task to retrieve data from a table in MS Access 2007 (ms access is 32 bit). The program code that I try to execute pops up with an error which says

DBI connect('Driver={Microsoft Access Driver (*.mdb,*.accdb)};DBQ=C:\test\INSTRUCTIONS.mdb','',...) failed: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (SQL-IM002) at C:/test/connectaccess.pl line 7.
cannot connect to DB at C:/test/connectaccess.pl line 7.  

The code is

#!perl  
use strict;  
use warnings;  
use DBI;  
my $DBFile = q(C:\test\INSTRUCTIONS.mdb);   
my $dbh = DBI->connect("dbi:ODBC:Driver={Microsoft Access Driver (*.mdb)};DBQ=$DBFile",'','') or die("cannot connect to DB");  
my $SQLquery = "SELECT * FROM IndemDate";  
my $sth = $dbh->prepare($SQLquery);
my $rc = $sth->execute;
while (my $href = $sth->fetchrow_hashref) {
print "memberID: " . $$href{"memberID"} . "\n";
print "memberName: " . $$href{"memberName"} . "\n";
print "\n";
}  

So I was wondering if 64 bit perl include all 32 bit modules... or is there any mistake in the connection to ms access. Please guide me.


Solution

  • The program works fine if I execute the program with 32-bit perl.