Test Connection fails for Type 2 Oracle Call Interface (OCI) Java database connectivity (JDBC) driver in V5
 Technote (FAQ)
 
Problem
If the test connection function fails on your Oracle® data source, you might need to initialize your Oracle database environment variables. This can be done in several ways. This technote helps you determine the best method for you to use.
 
Cause
Environment variables ORACLE_HOME and LIBPATH or LD_LIBRARY_PATH variables are not set properly.
 
Solution
After configuring an Oracle OCI JDBC driver, clicking the test connection button from the administrative console results in the following error.

For an Oracle 9i client, the error shown in the administrative console looks similar to the following:

Test Connection failed for datasource myDatasource on server server1 at
node
myNode with the following exception: java.sql.SQLException:
java.lang.UnsatisfiedLinkError:
/usr/local/oracle/sol-9.2.0/lib/libocijdbc9.so: ld.so.1:
/opt/WebSphere50/AppServer/java/bin/../bin/sparc/native_threads/java:
fatal: libclntsh.so.9.0: open failed: No such file or directory. View JVM logs
logs
com.ibm.ws.console.probdetermination.forwardCmd.do?forwardName=JVMLog.c
onfig.view&perspective=tab.runtime&lastPage=DataSourceCollection.content.mai
n&contextId=cells:myNodeNetwork:nodes:myNode:servers:server1> for
further details.


For an Oracle 8i client, the error in the SystemOut.log looks similar to the following:

[11/11/03 14:55:28:222 EST] 16e5d6 DataSourceCon E DSRA8040I: Failed to connect to the DataSource. Encountered : java.lang.UnsatisfiedLinkError: /usr/local/oracle/sol-8.1.7.4/lib/libocijdbc8.so: ld.so.1: /opt/WebSphere50/AppServer/java/bin/../bin/sparc/native_threads/java: fatal: libclntsh.so.8.0: open failed: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1414)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1322)
at java.lang.Runtime.loadLibrary0(Runtime.java:744)
at java.lang.System.loadLibrary(System.java:815)
at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:233)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:269)
at oracle.jdbc.driver.OracleD

The ORACLE_HOME and LIBPATH or LD_LIBRARY_PATH variables must be set for the required Oracle library files to be found.

These variables can be set in the following places:

  • In the .profile of the user that starts WebSphere Application Server

  • In the setupcmdline.sh script

  • In the startserver.sh

  • As environment entries in the Process Definition of the individual application server that will use the data source


Examples:

Solaris, Linux®, HP-UX:

Oracle 8i client:

ORACLE_HOME=/usr/local/oracle/sol-8.1.7.4

LD_LIBRARY_PATH=/usr/local/oracle/sol-8.1.7.4/lib

Oracle 9i client:

ORACLE_HOME=/usr/local/oracle/sol-9.2.0

LD_LIBRARY_PATH=/usr/local/oracle/sol-9.2.0/lib

AIX®:

Oracle 8i client:

ORACLE_HOME=/usr/local/oracle/sol-8.1.7.4

LIBPATH=/usr/local/oracle/sol-8.1.7.4/lib

Oracle 9i client:

ORACLE_HOME=/usr/local/oracle/sol-9.2.0

LIBPATH=/usr/local/oracle/sol-9.2.0/lib

 
 
Cross Reference information
Segment Product Component Platform Version Edition
Application Servers Runtimes for Java Technology Java SDK
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > DB Connections/Connection Pooling
Operating system(s): Windows
Software version: 5.0.2.9
Software edition:
Reference #: 1155887
IBM Group: Software Group
Modified date: Dec 1, 2004