{"id":4635,"date":"2015-04-26T20:00:52","date_gmt":"2015-04-26T12:00:52","guid":{"rendered":"http:\/\/rmohan.com\/?p=4635"},"modified":"2015-04-26T20:00:52","modified_gmt":"2015-04-26T12:00:52","slug":"setting-the-xa-transaction-timeout-values-for-a-datasource-through-wlst-script","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=4635","title":{"rendered":"Setting the XA Transaction timeout values for a datasource through WLST script"},"content":{"rendered":"<p>This post explain the approach to set some of the important timeout properties for XA datasources through WLST script.<\/p>\n<p><b>Set XA Transaction Timeout:<\/b><br \/>\nEnables WebLogic Server to set a transaction branch timeout based on the value for XaTransactionTimeout.<\/p>\n<p>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.<\/p>\n<p><b>XA Transaction Timeout:<\/b><br \/>\nThe number of seconds to set as the transaction branch timeout.<br \/>\nIf set, this value is passed as the transaction timeout value in the XAResource.setTransactionTimeout() call on the XA resource manager, typically the JDBC driver.<\/p>\n<p>When this value is set to 0, the WebLogic Server Transaction Manager passes the global WebLogic Server transaction timeout in seconds in the method.<\/p>\n<p>If set, this value should be greater than or equal to the global WebLogic Server transaction timeout.<\/p>\n<p><b>XA Retry Duration:<\/b><br \/>\nDetermines 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.<\/p>\n<p><b>XA Retry Interval:<\/b><\/p>\n<p>The number of seconds between XA retry operations if XARetryDurationSeconds is set to a positive value.<\/p>\n<p><b>SetXATimeoutProperties.py<\/b><\/p>\n<p>def setXATimeoutProperties():<br \/>\ndsName=&#8217;SOADataSource&#8217;<br \/>\nedit()<br \/>\nstartEdit()<br \/>\n<span class=\"Apple-converted-space\">\u00a0<\/span><br \/>\nserver=&#8217;AdminServer&#8217;<br \/>\ncd(&#8220;Servers\/&#8221;+server)<br \/>\ntarget=cmo<br \/>\n<span class=\"Apple-converted-space\">\u00a0<\/span><br \/>\nprint &#8216;=========================================&#8217;<br \/>\nprint &#8216;Setting the timeout properties for DataSource&#8230;.&#8217;<br \/>\nprint &#8216;=========================================&#8217; \u00a0<span class=\"Apple-converted-space\">\u00a0<\/span><br \/>\n<span class=\"Apple-converted-space\">\u00a0<\/span><br \/>\ncd(&#8216;\/JDBCSystemResources\/&#8217;+dsName+&#8217;\/JDBCResource\/&#8217;+dsName+&#8217;\/JDBCXAParams\/&#8217;+dsName)<br \/>\ncmo.setXaSetTransactionTimeout(true)<\/p>\n<p>cd(&#8216;\/JDBCSystemResources\/&#8217;+dsName+&#8217;\/JDBCResource\/&#8217;+dsName+&#8217;\/JDBCXAParams\/&#8217;+dsName)<br \/>\ncmo.setXaTransactionTimeout(3000)<\/p>\n<p>cd(&#8216;\/JDBCSystemResources\/&#8217;+dsName+&#8217;\/JDBCResource\/&#8217;+dsName+&#8217;\/JDBCXAParams\/&#8217;+dsName)<br \/>\ncmo.setXaRetryDurationSeconds(300)<\/p>\n<p>cd(&#8216;\/JDBCSystemResources\/&#8217;+dsName+&#8217;\/JDBCResource\/&#8217;+dsName+&#8217;\/JDBCXAParams\/&#8217;+dsName)<br \/>\ncmo.setXaRetryIntervalSeconds(60)<\/p>\n<p>save()<br \/>\nactivate()<\/p>\n<p>print &#8216;Timeout settings for the datasource &#8216;+dsName+&#8217; has been completed&#8217;<br \/>\n<span class=\"Apple-converted-space\">\u00a0<\/span><br \/>\n<span class=\"Apple-converted-space\">\u00a0<\/span><br \/>\ndef main():<br \/>\n<span class=\"Apple-converted-space\">\u00a0<\/span><br \/>\nadminURL=&#8217;t3:\/\/10.30.34.216:8000&#8242;<br \/>\nadminUserName=&#8217;weblogic&#8217;<br \/>\nadminPassword=&#8217;reuters123&#8242;<br \/>\nconnect(adminUserName, adminPassword, adminURL)<br \/>\nsetXATimeoutProperties()<br \/>\ndisconnect()<\/p>\n<p><span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<p>main()<\/p>\n<p>Execute the script:<br \/>\ncd %WLS_HOME%\\common\\bin<br \/>\nwlst.sh SetJDBCTimeoutProperties.py<\/p>\n<p>Restart the server after successful execution.<\/p>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2015\/04\/weblogicssrrerew-6.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4636\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2015\/04\/weblogicssrrerew-6.jpg\" alt=\"weblogicssrrerew-6\" width=\"560\" height=\"501\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2015\/04\/weblogicssrrerew-6.jpg 560w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/04\/weblogicssrrerew-6-300x268.jpg 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/04\/weblogicssrrerew-6-150x134.jpg 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2015\/04\/weblogicssrrerew-6-400x358.jpg 400w\" sizes=\"(max-width: 560px) 100vw, 560px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post explain the approach to set some of the important timeout properties for XA datasources through WLST script.<\/p>\n<p>Set XA Transaction Timeout: Enables WebLogic Server to set a transaction branch timeout based on the value for XaTransactionTimeout.<\/p>\n<p>When enabled, the WebLogic Server Transaction Manager calls XAResource.setTransactionTimeout() before calling XAResource.start, and passes either the XA [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[56],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4635"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4635"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4635\/revisions"}],"predecessor-version":[{"id":4637,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4635\/revisions\/4637"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4635"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4635"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4635"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}