1

I've been trying to connect to a MS Access 2007 database through JDBC (JDK is 64-bit under Windows 7 64-bit) and I receive the following error:

java.sql.SQLException: [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application.

I upgraded Access to 2010, I used odbcad32.exe in Windows\SysWOW64 and downloaded/installed 32-bit Microsoft Access Database Engine 2010 Redistributable (couldn't install the 64-bit MS Access Database Engine 2010 because I currently have 32-bit Office products installed), but I get still the same error.

What can I do to overcome this error?

Gord Thompson
  • 116,920
  • 32
  • 215
  • 418
user1680859
  • 1,160
  • 2
  • 24
  • 40
  • possible duplicate of [The specified DSN contains an architecture mismatch Error](http://stackoverflow.com/questions/20008501/the-specified-dsn-contains-an-architecture-mismatch-error) – Gord Thompson Feb 22 '14 at 12:59

1 Answers1

1

As I mention in my other answer here, you need to be running the Java application in a JVM (Java Virtual Machine) with the same "bitness" as the installed version of the Access Database Engine (a.k.a. "ACE"). Since you have the 32-bit version of ACE installed you will need to run the Java application in a 32-bit JVM.

Community
  • 1
  • 1
Gord Thompson
  • 116,920
  • 32
  • 215
  • 418
  • Should I install an additional 32-bit JRE on my system, only for this case? Will my other Java projects still work with the existing 64-bit JRE? – user1680859 Feb 22 '14 at 13:51
  • 1
    @user1680859 Yes, you can have both 32-bit and 64-bit JREs on the same machine. Your existing projects can continue to use the 64-bit JRE and you can specifically tell that one particular project to use the 32-bit environment. – Gord Thompson Feb 22 '14 at 13:59
  • I installed a 32-bit JRE on my system, and again the same error – user1680859 Feb 22 '14 at 14:01
  • 1
    @user1680859 Did you tell your Java project to actually *use* the 32-bit environment? – Gord Thompson Feb 22 '14 at 14:04
  • I download-ed a new 32-bit Eclipse version and I run the application there? Is this Ok or should I go through Build Path? – user1680859 Feb 22 '14 at 14:07
  • @user1680859 I would expect that a 32-bit version of Eclipse should have no problem accessing the 32-bit DSN you created. Did that work for you? – Gord Thompson Feb 22 '14 at 15:03
  • I managed it, very clear explanation @GordThompson. I installed 32-bit JRE, and added it in Eclipse through Preferences. And as the last step, I told to the Java project to use this new environment – user1680859 Feb 22 '14 at 15:09