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?
Oracle DatabaseLinux DistributionsJava

Avatar of undefined
Last Comment
dawhisman
ASKER CERTIFIED SOLUTION
Avatar of Ajay-Singh
Ajay-Singh

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
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.
Avatar of dawhisman
dawhisman

ASKER

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!
Java
Java

Java is a platform-independent, object-oriented programming language and run-time environment, designed to have as few implementation dependencies as possible such that developers can write one set of code across all platforms using libraries. Most devices will not run Java natively, and require a run-time component to be installed in order to execute a Java program.

102K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo