views:

2034

answers:

2

Hi,

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.

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.

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.

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?

Thanks, Fell

+1  A: 

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

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 -Djava.library.path=C:\mydirwiththedll com.mypackage.MyProgram

Jesper
im working with unix environment and tried setting the java.library.path to the LD_LIBRARY_PATH location...However now im getting the following link error : Can't load Sparc v9 64-bit .so on a Sparc 32-bit platform.How can I fix this ?
Fell
my solaris machine is 64 bit and im using jdk1.5
Fell
A: 

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

divi