java.lang.UnsatisfiedLinkError:java中没有ocijdbc11。 library.path [英] java.lang.UnsatisfiedLinkError: no ocijdbc11 in java. library.path
问题描述
我正在尝试将 jdbc oci连接发送到使用 os身份验证的 oracle 11g
i am trying to make jdbc oci connection to oracle 11g that uses os authentication
我制作了一个示例控制台应用程序来测试某些客户端计算机上的连接
i made a sample console application to test the connection on some client machine
我在 jdk 6 的机器上开发了应用程序并在项目中使用jar ojdbc6.jar 。
i developed the application on machine that has jdk 6 and used in the project the jar ojdbc6.jar.
我用来连接数据库的代码如下:
the code i am using to connect to database is as follows:
OracleDataSource ods = new OracleDataSource();
String tnsName="Prod";
ods.setURL("jdbc:oracle:oci:/@"+tnsName);
Connection conn = ods.getConnection();
我正在尝试从安装了oracle11g的客户机运行此应用程序,而oracle home是在路径上设置为: C:\\\ t \\\\\\\\\\
i am trying to run this application from client machine that has the oracle11g installed, and the oracle home is set on path to be: C:\orant\jdk\bin
路径: C:\ orant\bin 包含 oci.dll 且不包含 ocijdbc11.dll
客户端已经安装了jre7并且没有jdk。
the client has jre7 installed and doesn't have jdk.
当尝试在对oracle数据库进行os身份验证的客户端计算机上运行上面的代码时,我遇到以下异常:
when trying to run the above code on client machine that is os authenticated to oracle database i am getting following exception:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no ocijdbc11 in java.
library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at oracle.jdbc.driver.T2CConnection$1.run(T2CConnection.java:3178)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.jdbc.driver.T2CConnection.loadNativeLibrary(T2CConnection.java
:3174)
at oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:233)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:
508)
at oracle.jdbc.driver.T2CConnection.<init>(T2CConnection.java:133)
at oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtensio
n.java:53)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:510)
at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSou
rce.java:275)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java
:206)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java
:156)
at auth.Main.main(Main.java:42)
<请告知我如何修复此异常。
please advise how can i fix this exception.
推荐答案
我能够使用jdbc成功连接到oracle数据库的os连接这篇文章:
i was able to make successful os connection to oracle database with jdbc in this post:
这篇关于java.lang.UnsatisfiedLinkError:java中没有ocijdbc11。 library.path的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!