10 Using JDBC XA Drivers with WebLogic Server

This section provides an overview of XA JDBC drivers with WebLogic Server in distributed transactions. These drivers provide connectivity between WebLogic Server connection pools and the DBMS. Drivers used in distributed transactions are designated by the driver name followed by /XA; for example, Oracle Thin/XA Driver

This chapter includes the following sections:

Using Oracle Thin/XA Driver

WebLogic Server ships with the Oracle Thin Driver preconfigured and ready to use. If you want to update the driver or use a different version, see "Using API Extensions in JDBC Drivers" in Programming JDBC for Oracle WebLogic Server.

Set the Environment for the Oracle Thin/XA Driver

The following sections explain how to set the environment for the Oracle Thin/XA Driver.

Configure WebLogic Server

For information on how to configure WebLogic Server for use with the Oracle Thin/XA Driver, see "Using API Extensions in JDBC Drivers" in Programming JDBC for Oracle WebLogic Server.

Enable XA on the Database Server

To prepare the database for XA, perform these steps:

  1. Log on to sqlplus as system user, for example, sqlplus sys/CHANGE_ON_INSTALL@<DATABASE ALIAS NAME>

  2. Execute the following command: @xaview.sql

    The xaview.sql script resides in the $ORACLE_HOME/rdbms/admin directory

  3. All database users for which XA data sources are defined need to be granted the following permissions individually or through one or more roles:

    • grant select on v$xatrans$ to <user/role>;

    • grant select on pending_trans$ to <user/role>;

    • grant select on dba_2pc_pending to <user/role>;

    • grant select on dba_pending_transactions to <user/role>;

    • grant execute on dbms_xa to <user/role>;

    Where <user/role> is either a data base user or a role.

If the above steps are not performed on the database server, normal XA database queries and updates may work fine. However, when the WebLogic Server Transaction Manager performs recovery on a re-boot after a crash, recover for the Oracle resource fails with XAER_RMERR. Crash recovery is a standard operation for an XA resource.

Oracle Thin/XA Driver Configuration Properties

For information on how to configure data source properties, see "Configuring JDBC Data Sources" in Configuring and Managing JDBC Data Sources for Oracle WebLogic Server.

Using Other XA Drivers

To use other XA-compliant JDBC drivers, you must include the path to the driver class libraries in your CLASSPATH and follow the configuration instructions provided by the vendor.

Using WebLogic-branded Data Direct Drivers

For information on how to configure WebLogic Server for use with WebLogic-branded Data Direct drivers, see "Using WebLogic-branded DataDirect Drivers" in Programming JDBC for Oracle WebLogic Server

Additional Considerations

Your data base vendor may provide instructions to perform steps to prepare your environment for XA. These steps may include how to:

  • Enable your data base server for XA. This may include granting additional user permissions.

  • Compensate for vendor-specific transactional behavior, such as threading, timeout, and rollback behavior.

  • Use vendor-specific connection properties.

Consult your data base vendor documentation for specific details.