Skip navigation.
Downloads | Product Documentation | Support

WebLogic Type 4 JDBC Drivers

# Using WebLogic Type 4 JDBC Drivers

BEA WebLogic Type 4 JDBC drivers from DataDirect provide JDBC high-performance access through WebLogic Server to industry-leading data stores across the Internet and intranets. The BEA WebLogic Type 4 JDBC drivers are optimized for the Java environment, allowing you to incorporate Java technology and extend the functionality and performance of your existing system.

The WebLogic Type 4 JDBC drivers from DataDirect are proven drivers that:

- Support performance-oriented and enterprise functionality such as distributed transactions, savepoints, multiple open result sets and parameter metadata.
- Are J2EE Compatibility Test Suite (CTS) certified and tested with the largest JDBC test suite in the industry.
- Include tools for testing and debugging JDBC applications.

The following sections provide more information about the BEA WebLogic Type 4 JDBC drivers:

- JDBC Specification Compliance
- Installation
- License Requirements
- Supported Databases
- Connecting Through Data Sources and Connection Pools
- Specifying Connection Properties
- Required Permissions for the Java Security Manager
- XA Support
- Unicode Support
- Error Handling

# JDBC Specification Compliance

BEA WebLogic Type 4 JDBC drivers are compliant with the JDBC 3.0 specification. They also support several JDBC 2.0 Standard Extension Features. For details, see JDBC Support.

# Installation

WebLogic Type 4 JDBC drivers are installed with WebLogic Server in the `WL_HOME``\server\lib` folder, where `WL_HOME` is the directory in which you installed WebLogic Server. Driver class files are included in the manifest classpath in `weblogic.jar`, so the drivers are automatically added to your classpath on the server.

The WebLogic Type 4 JDBC drivers are not included in the manifest classpath of the WebLogic client jar files (e.g., `wlclient.jar`). To use the drivers with a WebLogic client, you must copy the following files to the client and add them to the classpath on the client:

- `wlbase.jar`
- `wlutil.jar`
- The DBMS-specific JAR file:

- For DB2: `wldb2.jar`
- For Informix: `wlinformix.jar`
- For MS SQL Server: `wlsqlserver.jar`
- For Oracle: `wloracle.jar`
- For Sybase: `wlsybase.jar`

# License Requirements

BEA WebLogic Type 4 JDBC drivers are licensed for use with WebLogic Server and with WebLogic Server clients only. At least one of the following files must be in your classpath for the license check to succeed:

- `weblogic.jar`
- `wlclient.jar`

# Supported Databases

Table 1-1 shows the databases supported by each of the BEA WebLogic Type 4 JDBC drivers.

Table 1-1 Supported Databases for BEA WebLogic Type 4 JDBC Drivers

Driver | Supported Databases
--- | ---
DB2 | DB2 Universal Database (UDB) v7.x, v8.1, and v8.2 on Linux, UNIX, and Windows via DRDA DB2 UDB v7.x and v8.1 for z/OS via DRDA DB2 UDB V5R1, V5R2, and V5R3 for iSeries
Informix | Informix 9.4 and higher
Oracle | Oracle 9i (R1 and R2) Oracle 10g (R1)
SQL Server | Microsoft SQL Server 2000 Microsoft SQL Server 2000 Desktop Engine (MSDE 2000) Microsoft SQL Server 2000 Enterprise Edition (64-bit) Microsoft SQL Server 2005 (WebLogic 8.1 SP6 and higher)
Sybase | Sybase Adaptive Server 11.5 and 11.9 Sybase Adaptive Server Enterprise 12.0, 12.5, 12.5.1, 12.5.2, and 12.5.3 Sybase Adaptive Server Enterprise 15

# Connecting Through Data Sources and Connection Pools

To use the WebLogic Type 4 JDBC drivers, you create a JDBC connection pool in your WebLogic Server configuration and select the JDBC driver to create the physical database connections in the connection pool. Then create a data source and point it to the connection pool. Applications can then look up the data source on the JNDI tree and request a connection.

See the following related information:

- For information about JDBC, connection pools, and data sources in WebLogic Server, see "JDBC," "JDBC Connection Pools," and "JDBC Data Sources" in the Administration Console Online Help.
- For information about requesting a connection from a data source, see "Configuring and Using DataSources" in Programming WebLogic JDBC.

# Specifying Connection Properties

You specify connection properties for connections in a connection pool using the WebLogic Server Administration Console, command line interface, or JMX API. Connection properties vary by DBMS. For the list of the connection properties specific to each BEA WebLogic Type 4 JDBC driver, see the appropriate driver chapter:

- For the DB2 driver, see DB2 Connection Properties.
- For the Informix driver, see Informix Connection Properties.
- For the MS SQL Server driver, see SQL Server Connection Properties.
- For the Oracle driver, see Oracle Connection Properties.
- For the Sybase driver, see Sybase Connection Properties.

## Limiting Connection Creation Time with LoginTimeout

When creating database connections in a JDBC connection pool, if the database is unavailable, the request may hang until the default system timeout expires. On some systems this can be as long as 9 minutes. The request will hang for each connection in the JDBC connection pool. To minimize this hang time, you can specify a `LoginTimeout` value for the connection. All WebLogic Type 4 JDBC Drivers support the `LoginTimeout` connection property. When you specify a `LoginTimeout` connection property, if the connection is not created immediately, the request waits for the time you specify. If the connection cannot be created within the time specified, the driver throws an SQL exception.

# Required Permissions for the Java Security Manager

Using the BEA WebLogic Type 4 JDBC drivers with the Java Security Manager enabled requires certain permissions to be set in the security policy file of the domain. WebLogic Server provides a sample security policy file that you can edit and use. The file is located at `WL_HOME``\server\lib\weblogic.policy`. The `weblogic.policy` file includes all necessary permissions for the drivers except for access to temporary files and access to `tnsnames.ora`. If you use the `weblogic.policy` file without changes, you may not need to grant any further permissions. If you use another security policy file or if you use driver features that require additional permissions, see the following sections for details about required permissions.

Note: Web browser applets running in the Java 2 plug-in are always running in a Java Virtual Machine with the Java Security Manager enabled.

For more information about using the Java Security Manager with WebLogic Server, see "Using Java Security to Protect WebLogic Resources" in Programming WebLogic Security.

## Permissions for Establishing Connections

To establish a connection to the database server, the BEA WebLogic Type 4 JDBC drivers must be granted the permissions as shown in the following examples. You must grant permissions to the `wlbase.jar` and `wlutil.jar` files as well as the jar for your specific database management system. You can grant the permissions to all JAR files in the directory or just to the specific files.

For all JAR files in the directory:

>     grant codeBase "file:WL_HOME${/}server${/}lib${/}-" {
>        permission java.net.SocketPermission "*", "connect";
>     };

For individual JAR files:

>     grant codeBase "file:WL_HOME${/}server${/}lib${/}wlbase.jar" {
>        permission java.net.SocketPermission "*", "connect";
>     };

>     grant codeBase "file:WL_HOME${/}server${/}lib${/}wlutil.jar" {
>        permission java.net.SocketPermission "*", "connect";
>     };

And one or more of the following:

>     //For DB2:
>     grant codeBase "file:WL_HOME${/}server${/}lib${/}wldb2.jar" {
>        permission java.net.SocketPermission "*", "connect";
>     };

>     //For Informix:
>     grant codeBase "file:WL_HOME${/}server${/}lib${/}wlinformix.jar" {
>        permission java.net.SocketPermission "*", "connect";
>     };

>     //For MS SQL Server:
>     grant codeBase "file:WL_HOME${/}server${/}lib${/}wlsqlserver.jar" {
>        permission java.net.SocketPermission "*", "connect";
>     };

>     //For Oracle:
>     grant codeBase "file:WL_HOME${/}server${/}lib${/}wloracle.jar" {
>        permission java.net.SocketPermission "*", "connect";
>     };

>     //For Sybase:
>     grant codeBase "file:WL_HOME${/}server${/}lib${/}wlsybase.jar" {
>        permission java.net.SocketPermission "*", "connect";
>     };

where `WL_HOME` is the directory in which you installed WebLogic Server.

In addition, if Microsoft SQL Server named instances are used, permission must be granted for the listen and accept actions as shown in the following example:

>     grant codeBase "file:WL_HOME${/}server${/}lib${/}-" {
>        permission java.net.SocketPermission "*", "listen, connect, accept";
>     };

## Granting Access to Java Properties

To allow the BEA WebLogic Type 4 JDBC drivers to read the value of various Java properties to perform certain operations, permissions must be granted as shown in the following example:

>     grant codeBase "file:WL_HOME${/}server${/}lib${/}-" {
>        permission java.util.PropertyPermission "false", "read";
>        permission java.util.PropertyPermission "user.name", "read";
>        permission java.util.PropertyPermission "user.language", "read";
>        permission java.util.PropertyPermission "user.country", "read";
>        permission java.util.PropertyPermission "os.name", "read";
>        permission java.util.PropertyPermission "os.arch", "read";
>        permission java.util.PropertyPermission "java.specification.version",
>           "read";
>     };

where `WL_HOME` is the directory in which you installed WebLogic Server.

You can also grant these permissions to individual files as shown in Permissions for Establishing Connections.

## Granting Access to Temporary Files

Access to the temporary directory specified by the Java Virtual Machine configuration must be granted in the security policy file, typically in the security policy file used by the JVM in the `JAVA_HOME``/jre/lib/security` folder. To use insensitive scrollable cursors or to perform client-side sorting of DatabaseMetaData result sets, all code bases must have access to temporary files. The following example shows permissions that have been granted for the `C:\TEMP` directory:

>     // permissions granted to all domains
>     grant codeBase "file:WL_HOME${/}server${/}lib${/}-" {
>     // Permission to create and delete temporary files.
>     // Adjust the temporary directory for your environment.
>        permission java.io.FilePermission "C:\\TEMP\\-", "read,write,delete";
>     };

where `WL_HOME` is the directory in which you installed WebLogic Server.

You can also grant these permissions to individual files as shown in Permissions for Establishing Connections.

## Granting Access to Oracle tnsnames.ora Files

If you are using an Oracle tnsnames.ora file to connect with the BEA WebLogic Type 4 Oracle driver, read access to the tnsnames.ora file must be granted to the driver in the security policy file of the Java 2 Platform.

>     grant codeBase "file:WL_HOME${/}server${/}lib${/}-" {
>        permission java.io.FilePermission "C:\\oracle\\ora92\\network\\admin\\
>           tnsnames.ora", "read";
>     };

where `WL_HOME` is the directory in which you installed WebLogic Server.

You can also grant these permissions to individual files as shown in Permissions for Establishing Connections.

See Using tnsnames.ora Files for more information about using `tnsnames.ora` files to connect to Oracle databases.

# XA Support

Although the WebLogic Type 4 JDBC drivers support XA, you may need to configure your database to support XA with the drivers. See the following sections for more details:

- For DB2, see JTA Support.
- For Microsoft SQL Server, see Installing Stored Procedures for JTA.
- For Sybase, see Sybase JTA Support

# Unicode Support

Multi-lingual applications can be developed on any operating system platform with JDBC using the BEA WebLogic Type 4 JDBC drivers to access both Unicode and non-Unicode enabled databases. Internally, Java applications use UTF-16 Unicode encoding for string data. When fetching data, the WebLogic Type 4 JDBC drivers automatically perform the conversion from the character encoding used by the database to UTF-16. Similarly, when inserting or updating data in the database, the drivers automatically convert UTF-16 encoding to the character encoding used by the database.

The JDBC API provides mechanisms for retrieving and storing character data encoded as Unicode (UTF-16) or ASCII. Additionally, the Java string object contains methods for converting UTF-16 encoding of string data to or from many popular character encodings.

# Error Handling

The BEA WebLogic Type 4 JDBC drivers report errors to the calling application by throwing SQLExceptions. Each SQLException contains the following information:

- Description of the probable cause of the error, prefixed by the component that generated the error
- Native error code (if applicable)
- String containing the XOPEN SQLstate

## Driver Errors

An error generated by a WebLogic Type 4 JDBC driver has the following format:

>     [BEA][WebLogic Type 4 JDBC driver name]message

For example:

>     [BEA][SQLServer JDBC Driver]Timeout expired.

You may need to check the last JDBC call your application made and refer to the JDBC specification for the recommended action.

## Database Errors

An error generated by the database has the following format:

>     [BEA][WebLogic Type 4 JDBC driver name][DBMS name] message

For example:

>     [BEA][SQL Server JDBC Driver][SQL Server] Invalid Object Name.

Use the native error code to look up details about the possible cause of the error. For these details, refer to your database documentation.