Tuesday, April 29, 2014

WLST script to set the XA Transaction timeout values for a data source in weblogic server

WLST script to set the XA Transaction timeout values for a data source in weblogic server

This tutorial explains the approach to set some of the important timeout properties for XA data sources in weblogic server through WLST script.

Set XA Transaction Timeout

Enables WebLogic Server to set a transaction branch timeout based on the value for XaTransactionTimeout.

When enabled, the WebLogic Server Transaction Manager calls XAResource.setTransactionTimeout() before calling XAResource.start, and passes either the XA Transaction Timeout value or the global transaction timeout.

XA Transaction Timeout

The number of seconds to set as the transaction branch timeout.
If set, this value is passed as the transaction timeout value in the XAResource.setTransactionTimeout() call on the XA resource manager, typically the JDBC driver.

When this value is set to 0, the WebLogic Server Transaction Manager passes the global WebLogic Server transaction timeout in seconds in the method.

If set, this value should be greater than or equal to the global WebLogic Server transaction timeout.

XA Retry Duration

Determines the duration in seconds for which the transaction manager will perform recover operations on the resource. A value of zero indicates that no retries will be performed.
XA Retry Interval

The number of seconds between XA retry operations if XARetryDurationSeconds is set to a positive value.

Please note the above configurations are only available to the data sources created with XA supported driver

WLST Script

The below wlst script set the required XA timeout properties
def setXATimeoutProperties():
   dsName='JDBC Data Source-0'
   print '========================================='
   print 'Setting the timeout properties for DataSource....'
   print '========================================='  
   activate()print 'Timeout settings for the datasource '+dsName+' has been completed'
def main():
    connect(adminUserName, adminPassword, adminURL)


Before executing the script change the configuration values as required

Execute the script — <<Oracle_Home>>\oracle_common\common\bin\wlst.cmd

Restart the server after successful execution. Now the XA configurations are enabled as required.

1 comment:

  1. what is XA Transaction Timeout? why it has to enable..? what's the relation between XA transaction and JDBC conn////if we enable XA tran...any help for tunning the server?