Win32::ODBC Windows 7 64bit MS/Access

I am trying (without much luck) to open a MS/Access 2007 DB with ActiveState Perl on Windows 7 64 bit.  I have created the 32bit DSN but Win32::ODBC is not finding the DSN.

Any ideas?
jchauncey60Asked:
Who is Participating?
 
Jim Dettman (Microsoft MVP/ EE MVE)Connect With a Mentor PresidentCommented:
Sounds to me like your app is 64 bit:

<<The error message is:
[Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application
>>

  As a test, I would create two DSN's:

1. Create a 32 bit system DSN as <DSNName> with c:\windows\sysWOW64\odbcad32.exe

2. Create a 64 bit system DSN as <DSNName>_64 wih c:\windows\system32\odbcad32.exe

  Now from your app, see which one is there.

Jim.
0
 
als315Commented:
You should start proper ODBC admin (from syswow64 folder):
http://support.microsoft.com/kb/942976/en-us
A 64-bit version of the Microsoft Windows operating system includes the following versions of the Microsoft Open Database Connectivity (ODBC) Data Source Administrator tool (Odbcad32.exe):
The 32-bit version of the Odbcad32.exe file is located in the %systemdrive%\Windows\SysWoW64 folder.
The 64-bit version of the Odbcad32.exe file is located in the %systemdrive%\Windows\System32 folder.
0
 
jchauncey60Author Commented:
Thanks als315, I have found and read the KB and followed the instructions. ActiveState Perl still does not see the DSN.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:
Is ActiveState Perl  as 32 bit or 64 bit application?   Doesn't matter the OS is 64bit, but the app.  It's the app that's trying to access thr driver that matters.

Jim.
0
 
jchauncey60Author Commented:
From the looks of it 32 bit

Summary of my perl5 (revision 5 version 14 subversion 2) configuration:

  Platform:
    osname=MSWin32, osvers=5.2, archname=MSWin32-x64-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
0
 
FishMongerCommented:
Did you setup a File or System DSN?

Did you test the connection from the Windows ODBC administrator tool?

Can you post your code and the exact error message you received?

Instead of using Win32::ODBC, you might want to use the DBI module along with DBD::ODBC.  The Win32 module is a little out of date and DBI is the De facto standard module for interacting with databases.
0
 
jchauncey60Author Commented:
I have tried both File and System DSN, same results.

The error message is:
[Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application

I have a 3rd party ODBC Test utility and it will connect ok.

The statement is:
my ($db)       = new Win32::ODBC("dsn=Picture");

I have considered moving to DBI, just not sure what all I have to change in my code to make it all work.  I don't have anything fancy:
$db->Sql()
$db->DumpError
$db->FetchRow()
$db->Data()
$db->Close

No rollbacks, no transactions, etc...  Any idea on complexity of conversion?
0
 
FishMongerCommented:
Did you create the dsn with the 3rd party tool or did you use the Windows ODBC administrator?  If it was created via the 3rd party tool, is the Windows tool also able to make a test connection?

Is the version of Access you're using 32bit or 64bit?

The ODBC module is 32 bit and perl is 32 bit.  The error message is saying it's seeing an "architecture mismatch" which appears to be a conflict between one part (perl and the module) being 32bit and the other (MS Access?) being 64bit.
0
 
jchauncey60Author Commented:
I created the DSN with the ODBC Administrator, the ODBC Test just a testing tool.

Access is 32bit and is actually located on a 32 bit Windows 7 server, accessed through a mapped drive.
0
 
jchauncey60Author Commented:
The 64bit Admin does not have a driver for MS/Access.
0
 
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:
So then you only have the 32 bit driver.  I take it that the app does see the 32 bit DSN you created?  Sorry, but I don't know Perl at all.

 You can BTW get a 64 bit driver for accessing an older Access DB.  Download this:

Microsoft Access Database Engine 2010 Redistributable
http://www.microsoft.com/en-us/download/details.aspx?id=13255

 and you'll be able to connect to any JET or ACE database back to Access 2000 with a 64 bit app.

Jim.
0
 
FishMongerConnect With a Mentor Commented:
I noticed that you don't have a username or password in your connection statement.  Is that how you're executing the statement or did you simply remove that portion from your post?

Try this test script which I used to successfully connect to a pervasive db (I don't have MS/Access).
#!/usr/bin/perl

use strict;
use warnings;
use DBI;
use DBD::ODBC;

my $dsn  = 'Picture';
my $user = 'username';
my $pass = 'password';
my $dbh  = DBI->connect("DBI:ODBC:$dsn", $user, $pass) or die DBI::errstr;

print "Hey, we are now connected to the database!\n";
$dbh->close;

Open in new window

0
 
jchauncey60Author Commented:
JDettman, the DB is Access 2007; will give the Driver a shot
FishMonger, the DB doesn't require a username/password.
0
 
jchauncey60Author Commented:
Sorry I have not said thanks, I've been fighting with another DB problem today.

When I tried the link from JDettman, the x64 will not install because I have Office 32 bit installed.

When I tried with the DBI example, I get the following error:

DBI connect('Picture','HASH(0x4bbbf0)',...) failed: [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application (SQL-IM014) at S:\Programs\test-dbi.pl line 6
0
 
jchauncey60Author Commented:
Ok I figured it out.  The version of PERL installed was 64 bit, I uninstalled and re-installed with 32 bit and I am working.  Thanks for all the pointers, they really helped!
0
All Courses

From novice to tech pro — start learning today.