java 11g 的 oci 驱动程序 (odbc5.jar) 可以与 10g 客户端一起使用吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1360840/
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
can oci driver for 11g (odbc5.jar) work with 10g client?
提问by Fell
I need to connect to Oracle9,10 and 11 in my java application.The client will always be present where the app will be run and I want the app to just work with username,password and instance (specified in tnsnames.ora).Hence I would like oci drivers with a connection string of type : jdbc:oracle:oci:@testora .Im using the driver: oracle.jdbc.driver.OracleDriver. I have a 10g client and am using jdk1.5. When I use the ojdbc14 jar from client lib path the app runs.
我需要在我的 java 应用程序中连接到 Oracle9、10 和 11。客户端将始终出现在应用程序运行的地方,我希望应用程序只使用用户名、密码和实例(在 tnsnames.ora 中指定)。因此我想要带有类型连接字符串的 oci 驱动程序:jdbc:oracle:oci:@testora。我使用驱动程序:oracle.jdbc.driver.OracleDriver。我有一个 10g 客户端并且正在使用 jdk1.5。当我使用客户端库路径中的 ojdbc14 jar 时,应用程序会运行。
But if I use the ojdbc5 driver then the app fails with Exception in thread "main" java.lang.UnsatisfiedLinkError: no ocijdbc11 in java. library.path exception.
但是,如果我使用 ojdbc5 驱动程序,那么应用程序将失败并在线程“main”中出现异常 java.lang.UnsatisfiedLinkError: no ocijdbc11 in java。library.path 异常。
What im looking for is a way to package a single jar(ojdbc5/ojdbc14) and a single driver which will use oci drivers to connect to the client that is present on local machine(9/10/11).This is the way I would prefer it.
我正在寻找的是一种打包单个 jar(ojdbc5/ojdbc14)和一个驱动程序的方法,该驱动程序将使用 oci 驱动程序连接到本地机器(9/10/11)上存在的客户端。这就是我的方式会更喜欢它。
If this is not possible can I search the unix box for oracle version,pick up the correct jar and then use it in classpath when invoking the app which is in jar format?
如果这是不可能的,我可以在 unix 框中搜索 oracle 版本,选择正确的 jar,然后在调用 jar 格式的应用程序时在类路径中使用它吗?
Thanks, Fell
谢谢,落
采纳答案by Jesper
java.lang.UnsatisfiedLinkError: no ocijdbc11 in java.library.path
java.lang.UnsatisfiedLinkError:java.library.path 中没有 ocijdbc11
This means that you are missing a DLL (ocijdbc11.dll) in the Java library path. Make sure you have that DLL and start your program like this:
这意味着您在 Java 库路径中缺少一个 DLL (ocijdbc11.dll)。确保你有那个 DLL 并像这样启动你的程序:
java -Djava.library.path=C:\mydirwiththedll com.mypackage.MyProgram
java -Djava.library.path=C:\mydirwiththedll com.mypackage.MyProgram
回答by divi
ojdbc5.jar is intended to work with jdk1.5.x either you are connecting to Oracle 10 or 11g shouldn't matter, ojdbc14.jar was intended for jdk1.4.x
ojdbc5.jar 旨在与 jdk1.5.x 一起使用,无论您是连接到 Oracle 10 还是 11g 都无所谓,ojdbc14.jar 旨在用于 jdk1.4.x

