Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
366 views
in Technique[技术] by (71.8m points)

java - The specified DSN contains an architecture mismatch Error

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...