Recently I asked for help using Perl to connect to Microsoft Access 10There were a number of suggestions one of which was that the problem may be due to whether I was using a 32 or 64 bit version of Perl.I now have been able to use both a 32 bit and 64 bit version of Perl, which have come from the same place for the Perl below (adapted from one of the suggestions).
use strict;
use DBI;
my $dbfile = "c:/temp/Database.accdb";
my $dbh_ok = 'yes';
my $dsn = 'driver=Microsoft Access Driver (*.mdb, *.accdb);dbq='.$dbfi
+le;
my $dbh = DBI->connect("dbi:ODBC:$dsn", '', '')
or ($dbh_ok = 'no');
if($dbh_ok eq 'no') {
print "Access DBI connection failed - error\n$DBI::errstr\n";
} else {
print "Access DBI connection made - handle <$dbh>\n";
}
With the 64 bit Perl I got the following.
>access_connect_pm.pz
DBI connect('driver=Microsoft Access Driver (*.mdb, *.accdb);dbq=c:/temp/Database.accdb','',...) failed:
MicrosoftODBC Driver Manager Data source name not found and no default driver specified (SQL-IM002) at c:\temp\access_connect_pm.pz line 6.
Access DBI connection failed – error,/br>
MicrosoftODBC Driver Manager Data source name not found and no default driver specified (SQL-IM002)
With the 32 bit Perl I got the following.
access_connect_pm.phz
Access DBI connection made - handle <DBI::db=HASH(0x2fbb8fc)>
So it does seem that it does matter whether a 32 bit or 64 bit Perl is used.
I guess there probably is a means of using a 64 bit version of Perl to make a connection to Access 10 but I do not know where to start to find out.