10-2 Programming JTA for Oracle WebLogic Server
The following sections provide information for using the Oracle ThinXA Driver with WebLogic Server.
10.2.1 Software Requirements for the Oracle ThinXA Driver
The Oracle ThinXA Driver requires the following:
■
Java 2 SDK 1.4.x or later.
■
Oracle server configured for XA transaction support.
10.2.2 Set the Environment for the Oracle ThinXA Driver
The following sections explain how to set the environment for the Oracle ThinXA Driver.
10.2.2.1 Configure WebLogic Server
See Using Oracle Extensions with the Oracle Thin Driver in Programming JDBC for Oracle WebLogic Server.
10.2.2.2 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 sysCHANGE_ON_ INSTALLDATABASE ALIAS NAME
2.
Execute the following command: xaview.sql The xaview.sql script resides in the ORACLE_HOMErdbmsadmin directory
3.
Grant the following permissions:
■
grant select on vxatrans to public or user;
■
grant select on pending_trans to public;
■
grant select on dba_2pc_pending to public;
■
grant select on dba_pending_transactions to public;
■
when using the Oracle Thin driver 10.1.0.3 or later: grant execute on dbms_system to user;
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 faisl with XAER_RMERR. Crash recovery is a standard operation for an XA resource.
10.2.3 Oracle ThinXA Driver Configuration Properties
The following table contains sample code for configuring a JDBC data source:
Note: The Oracle 10g and 9.2 Thin driver ojdbc14.jar are the
only versions of the driver supported for use with a Java 2 SDK 1.4.X.
Using JDBC XA Drivers with WebLogic Server 10-3
10.3 Using Sybase jConnect 5.5 and 6.0XA Drivers
The following sections provide important configuration information and performance issues when using the Sybase jConnect Driver 5.5 and 6.0XA Drivers:
■
Section 10.3.1, Configuring a Sybase Server for XA Support
■
Section 10.3.2, XA and Sybase Adaptive Server
■
Section 10.3.3, Configuration Properties for Java Clients
■
Section 10.3.4, Known Sybase jConnect 5.5 and 6.0XA Issues
10.3.1 Configuring a Sybase Server for XA Support
Follow these instructions to set up the environment on your database server:
■
Run sp_configure enable DTM,1 to enable transactions.
■
Run sp_configure enable xact coordination,1.
■
Run grant role dtm_tm_role to USER_NAME.
■
Copy the sample xa_config file from the SYBASE_INSTALL\OCS-12_ 0\sample\xa-dtm
subdirectory up three levels to SYBASE_INSTALL,where SYBASE_INSTALL
is the directory of your Sybase server installation. For example: SYBASE_INSTALL\xa_config
■
Edit the xa_config file. In the first [xa] section, modify the sample server name to reflect the correct server name.
To prevent deadlocks when running transactions, enable row level lock by default:
■
Run sp_configure lock scheme,0,datarows
10.3.2 XA and Sybase Adaptive Server
Correct support for XA connections is available in the Sybase Adaptive Server Enterprise 12.0 and later versions only. XA connections with WebLogic Server are not
supported on Sybase Adaptive Server 11.5 and 11.9.
Table 10–2 Oracle ThinXA Driver: Connection Pool Configuration
Property Name Property Value
Name oracleXAPool
URL jdbc:oracle:thin:serverName:porttypically 1521 on
Windows:sid DriverClassname
oracle.jdbc.xa.client.OracleXADataSource Database Username
Scott Properties
user=scott Test Table Name
DUAL
Note: The jConnect.jar, jconn2, and jconn3.jar files are no
longer included with WebLogic Server. You can, however, download the Sybase drivers directly from Sybase.