Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Can't establish Oracle OCI JDBC Connection

430356May 16 2005 — edited May 26 2005
Hello,

I am trying to set up my MacOS X 10.3.9 box to connect a java app to a remote Oracle 10g database using the Oracle OCI JDBC driver. Here is what I have done:

I installed the Oracle Client Instant package and created an environment variable DYLD_LIBRARY_PATH to point to the directory containing the OCI libraries. I also added the Oracle JDBC driver files (Oracle Database 10g 10.1.0.4 JDBC Drivers)



"echo $DYLD_LIBRARY_PATH" gives:
/Applications/Developer/ORACLE/10g/instantclient10_1

"ls -l /Applications/Developer/ORACLE/10g/instantclient10_1" gives:
-r--r--r-- 1 PJU PJU 1461081 5 Jul 2004 classes12.jar
-rwxr-xr-x 1 PJU PJU 14891264 13 Dec 10:57 libclntsh.dylib.10.1
-rw-r--r-- 1 PJU PJU 1516340 16 Nov 15:52 libnnz10.dylib
-rw-r--r-- 1 PJU PJU 1841448 24 Oct 2004 libocci.dylib.10.1
-rwxr-xr-x 1 PJU PJU 66160096 14 Dec 02:56 libociei.dylib
-rwxr-xr-x 1 PJU PJU 93028 9 Nov 2004 libocijdbc10.dylib
-rwxr-xr-x 1 PJU PJU 744612 24 Oct 2004 libsqlplus.dylib
-r--r--r-- 1 PJU PJU 1397543 5 Jul 2004 ojdbc14.jar

I created a simple connection test. I run the test with the following line command:

java -cp .:$DYLD_LIBRARY_PATH:$DYLD_LIBRARY_PATH/ojdbc14.jar ConnectionTest

Which produces the following output:

/Applications/Developer/ORACLE/10g/instantclient10_1:.:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java

Exception in thread "main" java.lang.UnsatisfiedLinkError: no ocijdbc10 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1517)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:834)
at oracle.jdbc.driver.T2CConnection.loadNativeLibrary(T2CConnection.java:2927)
at oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:225)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:347)
at oracle.jdbc.driver.T2CConnection.<init>(T2CConnection.java:139)
at oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:79)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:549)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at ConnectionTest.main(ConnectionTest.java:19)


Note a qui

Here is the code I am using:

import java.sql.Connection;
import java.sql.DriverManager;

public class ConnectionTest {

public static void main(String[] args) {
try {

System.out.println(System.getProperty("java.library.path"));

Class.forName("oracle.jdbc.driver.OracleDriver");
Connection connection = DriverManager.getConnection("jdbc:oracle:oci:@test.world", "user", "password");

} catch (Exception e) {
e.printStackTrace();
}
}
}


Anyone having an idea on what is missing?

Thanks for any pointers!

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 23 2005
Added on May 16 2005
3 comments
1,634 views