从 Java 类 (ocijdbc11.dll) 连接到 Oracle 数据库的问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3246313/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Problems connecting to Oracle database from Java classes (ocijdbc11.dll)
提问by tobre
I have some database import and export ant scripts that run little java programs to import and export data to and from oracle 11g.
我有一些数据库导入和导出 ant 脚本,它们运行小 Java 程序来从 oracle 11g 导入和导出数据。
The scripts used to work on Vista 32 bit, but stopped working with Windows 7 64 bit. There are two versions of ocijdbc11.dll that I can use.
这些脚本曾经在 Vista 32 位上工作,但在 Windows 7 64 位上停止工作。我可以使用两个版本的 ocijdbc11.dll。
When I use the 64bit version, the error message is: java.lang.UnsatisfiedLinkError: C:\tools\oracle\ocijdbc11.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform.
当我使用64位版本时,错误信息是:java.lang.UnsatisfiedLinkError: C:\tools\oracle\ocijdbc11.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform。
When I use the 32bit version, the error message is: java.lang.UnsatisfiedLinkError: C:\tools\oracle\ocijdbc11.dll: %1 is not a valid Win32 application.
当我使用 32 位版本时,错误消息是:java.lang.UnsatisfiedLinkError: C:\tools\oracle\ocijdbc11.dll: %1 is not a valid Win32 application。
Does anyone know what I would need to change to fix this?
有谁知道我需要改变什么来解决这个问题?
回答by Arne Burmeister
Sorry, I'm not a windows guru, but I also use an 11g from windows java, but not with the oci driver, but the ojdbc14.jar which contains the thin driver. This driver does not need a native dll as I know.
抱歉,我不是 windows 专家,但我也使用 windows java 中的 11g,但不是使用 oci 驱动程序,而是使用包含瘦驱动程序的 ojdbc14.jar。据我所知,该驱动程序不需要本机 dll。
The 11 in the jar is not the oracle server version, but the JDK version to be used with. So the ocijdbc11 is a JDK 1.1 compatible driver. You should use ojdbc14.jar, ojdbc5.jar or ojdbc6.jar (ojdbc14.jar also works with Java 6, but ojdbc6.jar not with Java 1.4).
jar 中的 11 不是 oracle 服务器版本,而是要使用的 JDK 版本。所以ocijdbc11 是一个JDK 1.1 兼容的驱动程序。您应该使用 ojdbc14.jar、ojdbc5.jar 或 ojdbc6.jar(ojdbc14.jar 也适用于 Java 6,但 ojdbc6.jar 不适用于 Java 1.4)。