Solved

Win32::ODBC Windows 7 64bit MS/Access

Posted on 2013-01-16
15
2,750 Views
Last Modified: 2013-01-17
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?
0
Comment
Question by:jchauncey60
  • 8
  • 3
  • 3
  • +1
15 Comments
 
LVL 39

Expert Comment

by:als315
Comment Utility
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
 

Author Comment

by:jchauncey60
Comment Utility
Thanks als315, I have found and read the KB and followed the instructions. ActiveState Perl still does not see the DSN.
0
 
LVL 57

Expert Comment

by:Jim Dettman (Microsoft MVP/ EE MVE)
Comment Utility
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
 

Author Comment

by:jchauncey60
Comment Utility
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
 
LVL 28

Expert Comment

by:FishMonger
Comment Utility
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
 

Author Comment

by:jchauncey60
Comment Utility
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
 
LVL 28

Expert Comment

by:FishMonger
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:jchauncey60
Comment Utility
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
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 300 total points
Comment Utility
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
 

Author Comment

by:jchauncey60
Comment Utility
The 64bit Admin does not have a driver for MS/Access.
0
 
LVL 57

Expert Comment

by:Jim Dettman (Microsoft MVP/ EE MVE)
Comment Utility
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
 
LVL 28

Assisted Solution

by:FishMonger
FishMonger earned 200 total points
Comment Utility
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
 

Author Comment

by:jchauncey60
Comment Utility
JDettman, the DB is Access 2007; will give the Driver a shot
FishMonger, the DB doesn't require a username/password.
0
 

Author Comment

by:jchauncey60
Comment Utility
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
 

Author Comment

by:jchauncey60
Comment Utility
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

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
This Micro Tutorial will teach you the basics of configuring your computer to improve its speed. It will also teach you how to disable programs that are running in the background simultaneously. This will be demonstrated using Windows 7 operating…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now