2

i got this error:

The specified DSN contains an architecture mismatch between the Driver and Application

while trying to connect to the database using NetBeans and Java Programming Language

I am using Microsoft Access 2010 and my system running at 64bit Windows 7.

How do i solve this problem? Thanks everyone.

Gord Thompson
  • 116,920
  • 32
  • 215
  • 418
Kaoru
  • 2,853
  • 14
  • 34
  • 68

1 Answers1

3

That message appears under the following circumstances:

  • you have the Access Database Engine (a.k.a. "ACE") installed,
  • you create an ODBC DSN for your database connection, and
  • your Java code is running in a JVM (Java Virtual Machine) whose "bit-ness" is different than that of the installed version of ACE.

For example,

  1. you could have the 32-bit version of ACE installed and be trying to connect from Java code running in a 64-bit JVM, or

  2. you could have the 64-bit version of ACE installed and be trying to connect from Java code running in a 32-bit JVM.

If you really want to use the JDBC-ODBC Bridge then the solution is to either switch to the "other" version of ACE (i.e., switch from 32-bit to 64-bit or vice versa), or have your Java code run under a JVM with the same "bit-ness" as the installed version of ACE.

(Note that if you have Office installed then "switching to 64-bit ACE" really means "switching to 64-bit Office". You can't "mix and match" 32-bit and 64-bit Office components.)

However, now that the JDBC-ODBC Bridge has been removed from Java 8 you should consider using the UCanAccess JDBC driver instead. It is a pure Java implementation that does not use Access ODBC to manipulate the database, so it works under both 32-bit and 64-bit JVMs on all platforms that run Java (i.e., not just Windows). For more details, see

Manipulating an Access database from Java without ODBC

Community
  • 1
  • 1
Gord Thompson
  • 116,920
  • 32
  • 215
  • 418
  • Before i install Access Database Engine, the ODBC Administrator cannot add the Microsoft Database Engine in System DSN tab and under add selection and i already tried to download Access Database Engine 64 bit (2010), but the installer says that i cannot install it, because Microsoft Office 2010. So i decided to install Access Database Engine 32 bit (2010) and the Microsoft Database Engine works properly and i can add that under add selection in System DSN. But when i run through NetBeans (Java), i am getting that error – Kaoru Nov 16 '13 at 02:31
  • 1
    @Kaoru Okay, so you need to download and install the 32-bit JDK (the page [here](http://www.java.com/en/download/faq/develop.xml) will lead you to it), and then you need to tell NetBeans to use the 32-bit Platform for that specific project (more information in another question [here](http://stackoverflow.com/q/17491277/2144390)). – Gord Thompson Nov 16 '13 at 13:43