简体   繁体   English

64位Java无法通过ODBC访问32位MS Access数据库

[英]64-bit Java can't access 32-bit MS Access database via ODBC

I've got a new 64-bit laptop and have installed STS 64-bit and Java 64-bit. 我有一台新的64位笔记本电脑,并安装了STS 64位和Java 64位。 I'm trying to create an ODBC connection to a 32-bi Microsoft database; 我正在尝试创建一个32-bi Microsoft数据库的ODBC连接; however the default Admin tools don't provide a driver for access. 但是默认的管理工具不提供访问驱动程序。 After googling around, I saw that there's an admin tool for creating 32-bit drivers located in C:\\Windows\\SysWOW64\\odbcad32.exe. 谷歌搜索后,我看到有一个管理工具,用于创建位于C:\\ Windows \\ SysWOW64 \\ odbcad32.exe中的32位驱动程序。 However, an ODBC connection created from that that gives me an error message indicating an architecture mismatch when I run the program: 但是,从中创建的ODBC连接会在运行程序时向我提供一条错误消息,指示体系结构不匹配:

"[Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application" “[Microsoft] [ODBC驱动程序管理器]指定的DSN包含驱动程序和应用程序之间的体系结构不匹配”

I think it's because the 64-bit Java is trying to use the 32-bit driver. 我认为这是因为64位Java正在尝试使用32位驱动程序。 To get around the problem, I tried to put the argument "-D32" in the VM arguments, but got the same result. 为了解决这个问题,我尝试将参数“-D32”放在VM参数中,但得到了相同的结果。

I'm thinking of uninstalling STS and Java and replacing them with the 32 bit versions. 我正在考虑卸载STS和Java并用32位版本替换它们。 Is there a better solution? 有更好的解决方案吗?

To load a 32-bit native library you need to have a 32-bit JVM. 要加载32位本机库,您需要具有32位JVM。

You don't need to uninstall Java, you can have as many version installed as you like. 您不需要卸载Java,您可以根据需要安装任意数量的版本。

You can use your 64-bit JVM to talk to a 32-bit JVM which loads your driver, but this may be more complicated than you need. 您可以使用64位JVM与加载驱动程序的32位JVM通信,但这可能比您需要的更复杂。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM