• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Windows 7 Access DB Connection Error "Architecture Mismatch"

 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using Windows 7 and MS Access 2007 for a Java application.

First, to set up the ODBC connection, I had to use a 32-bit version of the Admin tools.
That is, odbcad32 in c:/windows/syswow64.
(See Microsoft SQL Server Developer forum entries.)
I then used the DB Name for the driver and also selected the DB itself for the driver.

I got it set up and followed some old code I had to connect to the DB.
After some initial errors, I am partially connecting which means that the code is correct, I think.
The code follows:


I have the following error message from the DriverManager.getConnection statement (#18 above):
"The specified DSN contains an architecture mismatch between the Driver and Application"

So there is some problem in my ODBC setup or in the DB. But what is it?
 
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you analysis that this is a 32 vs 64 bits issue is right.

What happens if you set up a data source with c:\windows\system32\odbcad32.exe ?
That is bad advise. It doesn't work for Access.
 
Will Barbee
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I forgot to say that I am using a fairly new Win7 and MS Office Professional 2007.
And that means Access is 2007.
And the code I have worked for Access 2003.

Yes, I think it is a 32-bit/64-bit issue.

The problem is that if you use the Control Panel / Admin Tools / Data Sources (ODBC) program,
you will only get (MS) SQL Server as a driver. To get MS Access drivers, you MUST use the 32-bit
program.

The programs are getting through the Class.forName statement (Java ODBC Driver Name) OK.
But the DriverManager.getConnection gives the error.

Is there some glitch in Microsoft Win7 or Access 2007 (which costs minimum $159 to even talk to them)?
Or is there some disconnect in the sun.jdbc.odbc.JdbcOdbcDriver where 32-bit/64-bit
is connecting to Access 2007?
 
Ranch Hand
Posts: 152
VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what architecture is your Java runtime?
Looks like you are running a 64-bit program
and try to load 32-bit libraries.

That does not work.

Either you install everything 32-bit, as you
did with your admin tools.

Or everything 64-bit, as your JVM probably is.

have a look here for the 32-bit version.

Hope that helps
Matt
 
Will Barbee
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Matt:

Thank you.

I will try it as soon as I can.

WillB
 
Will Barbee
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Matt:

As the British say, your recommendations were SPOT ON!

I reloaded Java for 32-bit and was running and testing within an hour.

Thank you.
 
reply
    Bookmark Topic Watch Topic
  • New Topic