Link to home
Start Free TrialLog in
Avatar of jchauncey60
jchauncey60Flag for United States of America

asked on

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?
Avatar of als315
als315
Flag of Russian Federation image

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.
Avatar of jchauncey60

ASKER

Thanks als315, I have found and read the KB and followed the instructions. ActiveState Perl still does not see the DSN.
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.
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
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.
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?
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.
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.
ASKER CERTIFIED SOLUTION
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The 64bit Admin does not have a driver for MS/Access.
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.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
JDettman, the DB is Access 2007; will give the Driver a shot
FishMonger, the DB doesn't require a username/password.
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
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!