bea.com | products | dev2dev | support | askBEA

Download Docs | Site Map | Glossary
Search

Configuring and Using WebLogic jDriver for Oracle

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, you must complete the tasks described in this section:

- Checking Software Requirements for WebLogic jDriver for Oracle

- Checking Licensing Functionality

- Setting Up the Environment for Using WebLogic jDriver for Oracle

Checking Software Requirements for WebLogic jDriver for Oracle

This section lists the software requirements in the following areas:

- Supported Platforms

- Requirements for Running JDBC 2.0

Supported Platforms

For details about the platforms, operating systems, JVMs, DBMS versions, and client libraries supported by the WebLogic jDrivers, see WebLogic Server Certifications.

Requirements for Running JDBC 2.0

WebLogic Server 7.0 runs under the JDK 1.3.1 platform, supporting the JDBC 2.0 API— The JDBC 2.0 Core API and the JDBC Optional Package API that includes distributed transactions. In addition, you must use a driver that uses the Oracle Call Interface version 8 API.

Checking Licensing Functionality

To use WebLogic jDriver for Oracle, you must have the proper license. WebLogic jDriver for Oracle licensing functionality is included in the license file located in the BEA home directory where you installed this WebLogic Server. For example:

>     c:\bea\license.bea

If your license included WebLogic jDriver for Oracle when you installed or last updated your WebLogic Server license, no further action is required. If you are adding this functionality, you must get an updated license from your BEA sales representative. For instructions to update your license file, see Updating Your license.bea File in Installing BEA WebLogic Server.

Note: If you use WebLogic jDriver for Oracle when WebLogic Server is not running, you must include the path to the folder where license.bea resides in your CLASSPATH.

Setting Up the Environment for Using WebLogic jDriver for Oracle

To set up your environment to support the use of WebLogic jDrivers, you must 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 you must 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\ocixxxx

  Where 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.

Table 2-1 Oracle on Windows NT

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, you must 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 libweblogicoci38.so and libweblogicoxa38.so reside. For example:

  >     $WL_HOME/server/lib/solaris/ocixxxx

  Where 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.

Table 2-2 Oracle on 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.

Table 2-3 Path to Oracle Libraries Installed 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, you must 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. 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, you must run WebLogic Server on a 64-bit machine.

Syntax

For Oracle 8, use the following syntax:

- The directory in which the native interfaces (driver files) libweblogicoci38.sl and libweblogicoxa38.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/lib

For Oracle 9i, use the following syntax:

- The directory in which the native interfaces (driver files) libweblogicoci38.sl and libweblogicoxa38.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_PATH

For Oracle 9.0.1, your path may look like:

export SHLIB_PATH=
$WL_HOME/server/lib/hpux11/oci901_8:$ORACLE_HOME/lib32:$SHLIB_PATH

The following table provides the directory and Oracle client versions for HP-UX.

Table 2-4 Oracle on HP

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.

Table 2-5 Path to Oracle Libraries Installed 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 server

Where WL_HOME is the directory where WebLogic Platform is installed, typically c:\bea\weblogic700.

For detailed instructions for using the dbping utility, see Using the WebLogic Java Utilities in the Administration 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

1. 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 WebLogic Servers in the Administration Guide.

2. 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 Guide and Creating and Configuring a JDBC Connection Pool in the Administration Console Online Help.

Using the Connection Pool in an Application

Table 2-6

To use a connection pool in this type of application . . . | Establish a database connection using . . . | For details, see . . .
--- | --- | ---
Server-side (such as a servlet) | WebLogic RMI, Pool, and JTS drivers, or a DataSource on the JNDI tree | 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:

1. Enable JDBC logging. In the Administration Console, follow these steps:

   1. Click the Server node in the left pane.

   2. Select a specific server in the left pane.

   3. Select the Logging tab.

   4. Select the JDBC tab.

   5. Select Enable JDBC Logging.

2. Add JDBCDebug=true to the Properties for the connection pool. In the Administration Console, follow these steps:

   1. 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.

   2. In the right pane, select the Configuration—>General tab.

   3. In the Properties box, add the following text on a new line:

      >     JDBCDebug=true

      Then click Apply.

   4. Restart the server.

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 libweblogicoci38.so to libweblogicoci38_g.so. For distributed transactions, copy libweblogicoxa38.so to libweblogicoxa38_g.so.

- On a Windows NT platform, copy weblogicoci38.dll to weblogicoci38_g.dll. For distributed transactions, copy weblogicoxa38.dll to weblogicocoxa38_g.dll.

Preparing to Set Up a Development Environment and Use the WebLogic jDriver for Oracle

For more information, read the following:

Table 2-7

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).