Solved

Win32::ODBC Windows 7 64bit MS/Access

Posted on 2013-01-16
15
2,807 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
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 57
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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

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 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 300 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 57
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 200 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.

809 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