java.lang.UnsatisfiedLinkError: no ocijdbc9 in java.library.path

Hii,

I am trying to deploy a web application that uses ojdbc14.jar file(I put this in Tomcats web-app>web-inf>lib folder) for accessing database.

My Env:

Linux OS

Tomcat 5.0.28

Driver Classes: ojdbc14.jar

however, I am unable to find these classes and the exception shown in tomcat logs is as under:

java.lang.UnsatisfiedLinkError: no ocijdbc9 in java.library.path

at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)

at java.lang.Runtime.loadLibrary0(Runtime.java:823)

at java.lang.System.loadLibrary(System.java:1030)

at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:262)

at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:346)

at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:468)

at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)

Can someone help me on this?

I see that there should be some problem with the oracle library settings. Am I right?

Thanks in advance.

[1060 byte] By [Thotaa] at [2007-11-26 18:22:39]
# 1

> Hii,

> I am trying to deploy a web application that uses

> ojdbc14.jar file(I put this in Tomcats

> web-app>web-inf>lib folder) for accessing database.

Wrong. Put it in Tomcat's common/lib directory.

> My Env:

> Linux OS

> Tomcat 5.0.28

> Driver Classes: ojdbc14.jar

> however, I am unable to find these classes and the

> exception shown in tomcat logs is as under:

> java.lang.UnsatisfiedLinkError: no ocijdbc9 in

No, that's not what the exception says. Looks to me like your connection URL uses oci instead of thin driver.

> I see that there should be some problem with the

> oracle library settings. Am I right?

Your connection URL is wrong. I believe the OCI driver requires the use of a .dll for Windows or .so for *nix, and that's what isn't available. You should be using the 100% Java, type IV thin driver. No libraries needed beyond the JAR file. Consult the Oracle docs for the correct URL syntax. Should look like this:

String driver = "oracle.jdbc.driver.OracleDriver";

String url = "jdbc:oracle:thin:@host:1521:sid";

%

duffymoa at 2007-7-9 5:56:33 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

Hi,

Appreciate your thoughts.

But our project is forced to use thick drivers.

Can you tell me if having the dll alone will help me solve the issue?

I did try putting the jar file in common-lib under tomcat. But then, it doesnt work as you said coz of the missing dll file.

Thanks.

Thotaa at 2007-7-9 5:56:34 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3

You are trying to use Oracle 9 JDBC driver for Oracle 8 Client (OCI).

OCI driver is very sensitive for the version.

If Oracle 9 client is already installed on your server,

check your classpath and library path, your service possibly pointing to previous oracle 8 installation.

If Oracle 9 client is not installed on your server,

use classes12.zip for Oracle 8 JDBC driver

masuda1967a at 2007-7-9 5:56:34 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 4

> Hi,

>

> Appreciate your thoughts.

>

> But our project is forced to use thick drivers.

Why?

>

> Can you tell me if having the dll alone will help me solve the issue?

I think you need the .dll AND to set java.library.path to point to it.

%

duffymoa at 2007-7-9 5:56:34 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 5
To use OCI driver, I am assuming that you alreday have oracle client installed to your server.>> at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:262)This looks like oracle 8.
masuda1967a at 2007-7-9 5:56:34 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 6

Hi,

First, you must have an Oracle client installed on your server. From the ORACLE_HOME/jdbc/lib copy the ojdbc14.jar into Tomcat's common/lib (as someone suggested). This ensures you have the right version which is important with the OCI client.

You will also have to set an environment variable usually LD_LIBRARY_PATH (some *nixs are different here), and add the ORACLE_HOME/bin to that path.

If still no luck, check your path, and classpath.

If you're really desperate you can write a little utility to dump the contents of the java.library.path. But you shouldn't have to go that far.

frrwhata at 2007-7-9 5:56:34 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...