Link to home
Start Free TrialLog in
Avatar of dawhisman
dawhisman

asked on

JDBC connectivity error between Java app and Oracle 10.2 database.

I am getting an error when running a small Java program in Red Hat 4 stating Oracle library does not exist (error provided below) when the Java app attempts to perform a JDBC connection to an Oracle database.

the error:
- Empty stack (returning null)
Exception in thread "main" java.lang.UnsatisfiedLinkError: /u01/app1/oracle/10gdb/lib32/libocijdbc10.so: /u01/app1/oracle/10gdb/lib32/libocijdbc10.so: cannot open shared object file: No such file or directory

This  library DOES exist.

- Red Hat 4.0 x86_64
- Oracle database 10.2.0.2.0
- JRE 1.3 (Oracle delivered; embedded in software)
- JDK 5.0 (downloaded)

The "missing" library DOES exist so I suspect our problem is that we have a variable set wrong.  The variables I am tweaiing (in my troubleshooting) are follows:

PATH
CLASSPATH
LD_LIBRARY_PATH
JAVA_HOME

Here is my KSH script I'm running:

export ORACLE_HOME=/u01/app1/oracle/10gdb
export BASE=/u01/app2/heritage_prod
export JAVA_HOME=/u01/app1/jdk_1.5.0/jdk1.5.0_05
export ANT_HOME=/u01/app1/apache-ant-1.7.0
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/u01/app1/oracle/10gdb/lib32/libocijdbc10.so
export PATH=$ANT_HOME/bin:$JAVA_HOME/bin:$PATH:$LD_LIBRARY_PATH
export CLASSPATH=/u01/app1/stage/jdbc/classes12.jar:/u01/app1/oracle/10gdb/lib32:.
cd $BASE
ant -debug -logfile $BASE/run_ant_log.txt -f $BASE/run.xml run_corporate_insert

Does anyone see anything wrong with how these variables are set?

If settings look right:  What other reasons might cause this error to occur?
ASKER CERTIFIED SOLUTION
Avatar of Ajay-Singh
Ajay-Singh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dawhisman
dawhisman

ASKER

Well, I believe that was how I originally had LD_LIBRARY_PATH set and it didn't work, which is why we tried setting it directly to the shared object.  I tried your suggestion and got same result:  File not found.
Ajay_Singh,

While your suggestion was not exactly correct it did make me realize my mistake upon further reflection:  I had my library getting set to the 32-bit libraries while I'm running 64-bit Linux.  I shifted around the LD_LIBRARY_PATH sequence (so /lib is used first instead of /lib32) and voila!  Problem fixed.

Since you are the only one who responded and since you mostly had the correct answer I will award you the points.  Thanks!