我遇到了让OCI JDBC工作的问题。 我需要使用oci驱动程序,因为当它已经过期且处于宽限时间时,您无法在登录时设置新密码。
我使用oracle 11g第2版
我下载了基本的instantclient-basic-windows.x64-11.2.0.4.0并解压缩。它位于文件夹中
C:\Users\Yeslan to the Coa\workspace\KWIKI\instantclient_11_2\
。
我已将此链接添加到PATH
系统变量。
我将eclipse中的本机库位置设置为该路径。
当我尝试登录oracle时:
protected static OracleConnection con;
static String url = "jdbc:oracle:oci:@//192.168.97.10:1521/orcl";
static String user = "user";
static String pw = "password";
public final Connection openCon() {
Properties prop = new Properties();
try {
System.out.println("openCon(): URL = " + url + " username = "
+ user + " password = " + pw);
prop.setProperty("user", user);
prop.setProperty("password", pw);
con = (OracleConnection) DriverManager.getConnection(url, prop);
con.setAutoCommit(false);
System.out.println("oracle con ok");
return con;
} catch (SQLException e) {
e.printStackTrace();
String errMessage = e.getMessage();
System.out.println("oracle con not opened because: " + errMessage);
}
}
我收到以下错误消息:
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: C:\Users\Yeslan to the Coa\workspace\KWIKI\instantclient_11_2\ocijdbc11.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(Unknown Source)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
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:3560)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.jdbc.driver.T2CConnection.loadNativeLibrary(T2CConnection.java:3556)
at oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:269)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:553)
at oracle.jdbc.driver.T2CConnection.<init>(T2CConnection.java:165)
at oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:53)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:528)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at at.nje.DB_FTP_Operations.ConnectOrcl.openCon(ConnectOrcl.java:76)
at at.nje.Kone.GUI.AdminFrame.<init>(AdminFrame.java:60)
at at.nje.Kone.GUI.AdminFrame$1.run(AdminFrame.java:46)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
请告诉我我错过了什么,或者我做错了什么。 如何在win 7 64上设置oci jdbc以连接到oracle 11g release 2