指定的 DSN 包含架构不匹配错误 [英] The specified DSN contains an architecture mismatch Error
问题描述
我收到此错误:
指定的 DSN 包含驱动程序之间的架构不匹配与应用
The specified DSN contains an architecture mismatch between the Driver and Application
尝试使用 NetBeans 和 Java 编程语言连接到数据库时
while trying to connect to the database using NetBeans and Java Programming Language
我使用的是 Microsoft Access 2010 并且我的系统在 64 位 Windows 7 上运行.
I am using Microsoft Access 2010 and my system running at 64bit Windows 7.
我该如何解决这个问题?谢谢大家.
How do i solve this problem? Thanks everyone.
推荐答案
该消息出现在以下情况下:
That message appears under the following circumstances:
- 您已经安装了 Access 数据库引擎(又名ACE"),
- 您为数据库连接创建了一个 ODBC DSN,并且
- 您的 Java 代码在 JVM(Java 虚拟机)中运行,其位数"与已安装的 ACE 版本不同.
例如
您可以安装 32 位版本的 ACE,并尝试从在 64 位 JVM 中运行的 Java 代码进行连接,或者
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
您可以安装 64 位版本的 ACE,并尝试从在 32 位 JVM 中运行的 Java 代码进行连接.
you could have the 64-bit version of ACE installed and be trying to connect from Java code running in a 32-bit JVM.
如果您真的想要使用 JDBC-ODBC 桥,那么解决方案是切换到其他"版本的 ACE(即从 32 位切换到 64 位或副反之亦然),或者让您的 Java 代码在与安装的 ACE 版本具有相同位数"的 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.
(请注意,如果您安装了 Office,那么切换到 64 位 ACE"实际上意味着切换到 64 位 Office".您不能混合搭配"32 位和 64 位 Office 组件.)
(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.)
但是,既然 JDBC-ODBC Bridge 已从 Java 8 中删除,您应该考虑使用 UCanAccess JDBC 驱动程序.它是一个纯 Java 实现,不使用 Access ODBC 来操作数据库,因此它可以在运行 Java 的所有平台(即,不仅仅是 Windows)上的 32 位和 64 位 JVM 下工作.详情请见
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
在没有 ODBC 的情况下从 Java 操作 Access 数据库
这篇关于指定的 DSN 包含架构不匹配错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!