Java – the specified DSN contains an architecture mismatch error

I received this error:

An error occurred while trying to connect to the database using NetBeans and the Java programming language

I am using Microsoft Access 2010 and my system to run on 64 bit Windows 7

How can I solve this problem? Thank you

Solution

This message is displayed when:

>You have installed access database engine (a.k.a. "ace"), > create ODBC DSN for database connection, and > your Java code runs in JVM (Java virtual machine), and its "bit ness" is different from the installed ace version

For example,

>You can install a 32-bit version of ACE and try to connect from Java code running in a 64 bit JVM, or > you can install a 64 bit version of ACE and try to connect from Java code running in a 32-bit JVM

If you really want to use jdbc-odbc bridge, the solution is to switch to the "other" version of ACE (that is, switch from 32-bit to 64 bit, and vice versa), or let your Java code run a JVM with the same "bit ness" as the installed ace version

(note that if office is installed, "switch to 64 bit ace" actually means "switch to 64 bit office". You cannot "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 It is a pure java implementation and does not use access ODBC to operate the database, so it can run under 32-bit and 64 bit JVMs on all platforms running Java (that is, not just windows) For more information, see

Manipulating an Access database from Java without ODBC

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>