Configuring WebLogic jDriver for Oracle
This section discusses the following topics:
- Preparing to Use WebLogic jDriver for Oracle
- Setting Up the Environment for Using WebLogic jDriver for Oracle
- Checking Connections to the Oracle Database
- Setting Up a Connection Pool
- Using IDEs or Debuggers with WebLogic jDrivers
- Preparing to Set Up a Development Environment and Use the WebLogic jDriver for Oracle
Preparing to Use WebLogic jDriver for Oracle
Before you can use the WebLogic jDriver for Oracle, complete the tasks described in this section:
- Checking Software Requirements for WebLogic jDriver for Oracle
- Setting Up the Environment for Using WebLogic jDriver for Oracle
Checking Software Requirements for WebLogic jDriver for Oracle
For details about the platforms, operating systems, JVMs, DBMS versions, and client libraries supported by the WebLogic jDrivers, see WebLogic Server Supported Configurations.
Setting Up the Environment for Using WebLogic jDriver for Oracle
To set up your environment to support the use of WebLogic jDrivers, set your path variable to include pathnames for the following:
- The directory that contains the WebLogic jDriver for Oracle. (The driver file may be a native dll, so, or sl file, depending on your operating system.) The file containing the driver must be available to your WebLogic Server client. The name of the path variable depends on the system you are using:
- On a Windows system, set PATH.
- On most UNIX systems, set LD_LIBRARY_PATH.
- On an HP-UX system, set SHLIB_PATH.
The directory containing the driver file varies, depending on several factors discussed in the following text.
- The directory in which vendor-supplied libraries from Oracle reside. The location of the directory containing your Oracle client libraries varies, depending on your installation. On Windows NT, the Oracle installer places these libraries in your system path. The directory name varies based on the operating system and its architecture (32-bit or 64-bit).
WebLogic Server uses the dll, so, or sl files built with the Oracle Call Interface (OCI) version 8 API as the native interface for accessing an Oracle DBMS.
The tables in the following platform-specific sections list the directories - based on the Oracle client version - that specify in your system PATH to access the desired version of the driver.
Windows NT
Add the pathnames for the WebLogic shared library (.dll) directory and the directory where you installed the Oracle client to the PATH as follows:
Syntax
Use the following syntax:
- Add WL_HOME\server\bin\ and the appropriate WebLogic Server shared library directory from the table below to your PATH, where WL_HOME is the directory of your WebLogic Server installation. For example:
%WL_HOME%\server\bin\ocixxxxWhere xxxx is either 817_8 for Oracle 8.1.7, 901_8 for Oracle 9.0.1, or 920_8 for Oracle 9.2.0.
- Add ORACLE_HOME\bin to your PATH, where ORACLE_HOME is the directory of your Oracle client installation. Always add the WebLogic jDriver for Oracle and Oracle home information at the beginning of your PATH. For example:
%ORACLE_HOME%\bin;%PATH%
Example
Using the above syntax to create an actual example for Oracle 8.1.7, your path may look like:
$set PATH=%WL_HOME%\server\bin\oci817_8;%ORACLE_HOME%\bin;%PATH%The following table provides the directory and Oracle client versions for Windows.
Oracle Client Version
OCI API Version
Shared Library (.dll) Directory
Notes
8.1.7 8 oci817_8 Allows access to Oracle 8 and JDBC 2.0 Core API and Optional Package API (includes distributed transactions). 9.0.1 8 oci901_8 Allows access to Oracle 9.0 and JDBC 2.0 Core API and Optional Package API (includes distributed transactions). 9.2.0 8 oci920_8 Allows access to Oracle 9.2 and JDBC 2.0 Core API and Optional Package API (includes distributed transactions).
Solaris
To set up your Solaris environment to support the use of WebLogic jDrivers, set your environment variable LD_LIBRARY_PATH to include the directory that contains the native interface file (the driver file) and the directory in which you installed the Oracle client.
Syntax
Use the following syntax:
- The directory in which the native interfaces libweblogicoci39.so and libweblogicoxa39.so reside. For example:
$WL_HOME/server/lib/solaris/ocixxxxWhere xxxx is either 817_8 for Oracle 8.1.7, 901_8 for Oracle 9.0.1, or 920_8 for Oracle 9.2.0.
- The directory in which vendor-supplied libraries from Oracle reside. The location of the directory containing your Oracle client libraries varies, depending on your installation. For example:
$ORACLE_HOME/lib
Example
Using the above syntax to create an actual path for Oracle 8.1.7, your path may look like:
export LD_LIBRARY_PATH=$WL_HOME/server/lib/solaris/oci817_8:$ORACLE_HOME/lib:$LD_LIBRARY_PATH
The following table provides the directory and Oracle client versions for Solaris.
Oracle Client Version
OCI API Version
Shared Library (.so) Directory
Notes
8.1.7 8 oci817_8 Allows access to Oracle 8 and JDBC 2.0 Core API and Optional Package API (includes distributed transactions). 9.0.1 8 oci901_8 Allows access to Oracle 9 and JDBC 2.0 Core API and Optional Package API (includes distributed transactions). 9.2.0 8 oci920_8 Allows access to Oracle 9.2 and JDBC 2.0 Core API and Optional Package API (includes distributed transactions). The following table lists the directory in which vendor-supplied libraries from Oracle reside for 32-bit and 64-bit installations on Solaris.
Oracle Client Version
Architecture
Path to Oracle Libraries
8.1.7 32-bit ORACLE_HOME/lib 8.1.7 64-bit ORACLE_HOME/lib64 9.0.1 32-bit ORACLE_HOME/lib32 9.0.1 64-bit ORACLE_HOME/lib 9.2.0 32-bit ORACLE_HOME/lib32 9.2.0 64-bit ORACLE_HOME/lib
IBM AIX
To find out if your platform is supported, see BEA WebLogic Server Certifications.
HP-UX 11
To set up your HP environment to support the use of WebLogic jDrivers, set your environment variable SHLIB_PATH to include the directory that contains the native interface file (driver file) and the directory in which you installed your Oracle client.
Note: Oracle 9 for HP-UX is available in a 64-bit version only, including the Oracle client, and can only be installed on 64-bit machines. Because the WebLogic jDriver for Oracle is a type-2 JDBC driver, it requires the Oracle client for database access. Therefore, to use the WebLogic jDriver for Oracle with Oracle 9, run WebLogic Server on a 64-bit machine. The Oracle 9 installation contains both 32-bit and 64-bit libraries. The WebLogic jDriver uses the 32-bit libraries so set SHLIB_PATH as described below.
Syntax
For Oracle 8, use the following syntax:
- The directory in which the native interfaces (driver files) libweblogicoci39.sl and libweblogicoxa39.so for Oracle 8i reside. For example:
$WL_HOME/server/lib/hpux11/oci817_8- The directory in which vendor-supplied libraries from Oracle reside. The location of the directory containing your Oracle client libraries varies, depending on your installation. For example:
$ORACLE_HOME/libFor Oracle 9i, use the following syntax:
- The directory in which the native interfaces (driver files) libweblogicoci39.sl and libweblogicoxa39.so for Oracle 9i reside. For example:
$WL_HOME/server/lib/hpux11/oci901_8- The directory in which vendor-supplied libraries from Oracle reside. The location of the directory containing your Oracle client libraries varies, depending on your installation. For example:
$ORACLE_HOME/lib32
Example
Using the above syntax to create an actual path for Oracle 8.1.7, your path may look like:
export SHLIB_PATH=
$WL_HOME/server/lib/hpux11/oci817_8:$ORACLE_HOME/lib:$SHLIB_PATHFor Oracle 9.0.1, your path may look like:
export SHLIB_PATH=
$WL_HOME/server/lib/hpux11/oci901_8:$ORACLE_HOME/lib32:$SHLIB_PATHThe following table provides the directory and Oracle client versions for HP-UX.
Oracle Client Version
OCI API Version
Shared Library
(.sl) Directory
Notes
8.1.7 8 oci817_8 Allows access to Oracle 8 and JDBC 2.0 Core API and Optional Package API (includes distributed transactions). 9.0.1 8 oci901_8 Allows access to Oracle 9 and JDBC 2.0 Core API and Optional Package API (includes distributed transactions). 9.2.0 8 oci920_8 Allows access to Oracle 9.2 and JDBC 2.0 Core API and Optional Package API (includes distributed transactions). The following table lists the directory in which vendor-supplied libraries from Oracle reside for 32-bit and 64-bit installations on HP.
Oracle Client Version
Architecture
Path to Oracle Libraries
8.1.7 32-bit ORACLE_HOME/lib 8.1.7 64-bit ORACLE_HOME/lib64 9.0.1 32-bit ORACLE_HOME/lib32 9.0.1 64-bit ORACLE_HOME/lib 9.2.0 32-bit ORACLE_HOME/lib32 9.2.0 64-bit ORACLE_HOME/lib
SGI IRIX
To find out if your platform is supported, see BEA WebLogic Server Certifications.
Siemens MIPS
To find out if your platform is supported, see BEA WebLogic Server Certifications.
Compaq Tru64 UNIX
To find out if your platform is supported, see BEA WebLogic Server Certifications.
Checking Connections to the Oracle Database
Once you have installed WebLogic jDriver for Oracle, verify that you can use it to connect to your database. To test your connection, use a utility called dbping that is provided with the WebLogic Server software.
To set your environment and to use dbping, type the following commands on the command line:
WL_HOME\server\bin\setWLSEnv.cmd
set path=WL_HOME\server\bin\oci817_8;%PATH%
java utils.dbping ORACLE user password serverWhere WL_HOME is the directory where WebLogic Platform is installed, typically c:\bea\weblogicXX.
For detailed instructions for using the dbping utility, see Using the WebLogic Java Utilities in the Command Reference Guide.
If you have problems, check Testing JDBC Connections and Troubleshooting in Programming WebLogic JDBC.
Setting Up a Connection Pool
If you are using WebLogic jDriver for Oracle with either BEA WebLogic Server or BEA WebLogic Express, you can set up a pool of connections to your Oracle DBMS to be established when WebLogic Server starts. Because the connections are shared among users, these connection pools eliminate the overhead of opening a new database connection for each user.
Your application then looks up a DataSource on the JNDI tree and requests a connection from the connection pool. When finished with the database connection, your application returns it to the connection pool.
Configuring a Connection Pool with WebLogic Server Software
- Include the vendor-supplied native libraries and the WebLogic native libraries for WebLogic Server in the PATH (Windows) or load library path (UNIX) of the shell where you will start WebLogic Server. For more information, see Starting and Stopping Servers in the Administration Console Online Help.
- Use the Administration Console to set up connection pools. To read about connection pools, see JDBC Components - Connection Pools, Data Sources, and MultiPools in the Administration Console Online Help and Configuring JDBC Connection Pools in the Administration Console Online Help.
Using the Connection Pool in an Application
To use a connection pool in this type of application . . .
Establish a database connection using . . .
For details, see . . .
Server-side (such as a servlet) DataSource on the JNDI tree or the WebLogic RMI, Pool, and JTS drivers Connecting To a Database Using a JDBC Connection Pool in Programming WebLogic HTTP Servlets.
Logging JDBC Activity on a Client Application
If you are using a connection from a connection pool (that uses the WebLogic jDriver for Oracle to create database connections) in a client application , JDBC activity on the client is not automatically included in the JDBC log on the server. To enable JDBC logging and to include JDBC activity on the client in the JDBC log on the server, follow these steps:
- Enable JDBC logging. In the Administration Console, follow these steps:
- Click the Server node in the left pane.
- Select a specific server in the left pane.
- Select the Logging tab.
- Select the JDBC tab.
- Select Enable JDBC Logging.
- Optionally, change the JDBC log file path and name.
- Add JDBCDebug=true to the Properties for the connection pool. In the Administration Console, follow these steps:
- In the left pane, click to expand the JDBC and Connection Pool nodes and select the connection pool for which you want to log client JDBC activity.
- In the right pane, select the Configuration
- > General tab.- In the Properties box, add the following text on a new line:
JDBCDebug=true
Using IDEs or Debuggers with WebLogic jDrivers
If you are using an integrated development environment (IDE) or a debugger, copy the WebLogic-supplied native library (driver file) to a new file with a name that ends in _g before the file extension. For example,
- On a UNIX system, copy libweblogicoci39.so to libweblogicoci39_g.so. For distributed transactions, copy libweblogicoxa39.so to libweblogicoxa39_g.so.
- On a Windows NT platform, copy weblogicoci39.dll to weblogicoci39_g.dll. For distributed transactions, copy weblogicoxa39.dll to weblogicocoxa39_g.dll.
Preparing to Set Up a Development Environment and Use the WebLogic jDriver for Oracle
For more information, read the following:
For information about . . .
See the section called . . .
Using the driver Using WebLogic jDriver for Oracle in Configuring and Using WebLogic jDriver for Oracle (this guide).