[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Win32::ODBC Windows 7 64bit MS/Access

Posted on 2013-01-16
15
Medium Priority
?
2,996 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 3
  • 3
  • +1
15 Comments
 
LVL 40

Expert Comment

by:als315
ID: 38786488
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
ID: 38786694
Thanks als315, I have found and read the KB and followed the instructions. ActiveState Perl still does not see the DSN.
0
 
LVL 58
ID: 38787384
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
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 

Author Comment

by:jchauncey60
ID: 38788162
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
ID: 38788171
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
ID: 38788229
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
ID: 38788379
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
 

Author Comment

by:jchauncey60
ID: 38788388
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 58

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 900 total points
ID: 38788517
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
ID: 38788525
The 64bit Admin does not have a driver for MS/Access.
0
 
LVL 58
ID: 38788731
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 600 total points
ID: 38788906
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
ID: 38788959
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
ID: 38789992
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
ID: 38790163
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
This Micro Tutorial will give you basic overview of the control panel section on Windows 7. It will depth in Network and Internet, Hardware and Sound, etc. This will be demonstrated using Windows 7 operating system.
Six Sigma Control Plans
Suggested Courses

656 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