Friday, August 13, 2010

Modifying DataSource connection pool properties/advanced/custom using jython

1.       Prepare a script with required parameters as below and save in a file (ex:modifyds)

AdminConfig.modify('(cells/<hostname>Node01Cell/nodes/<hostname>Node01/servers/server1|resources.xml#ConnectionPool_1281713531147)', '[[connectionTimeout "888"] [maxConnections "888"] [unusedTimeout "888"] [minConnections "18"] [purgePolicy "EntirePool"] [agedTimeout "8888"] [reapTime "8888"][freePoolDistributionTableSize "8"] [stuckTime "8"] [stuckTimerTime "8"] [surgeCreationInterval "8"] [numberOfSharedPoolPartitions "8"] [stuckThreshold "8"] [numberOfFreePoolPartitions "8"] [surgeThreshold "-1"]]')

AdminConfig.create('Property', '(cells/<hostname>Node01Cell/nodes/<hostname>Node01/servers/server1|resources.xml#ConnectionPool_1281713531147)', '[[validationExpression ""] [name "test"] [description "test"] [value "test"] [required "false"]]')

AdminConfig.save()

2.       Copy the file to the server to some folder (ex: /var/scripts)

3.       Run the following command

./wsadmin.sh -lang jython -f /var/scripts/modifyds

4.       Connects to the server/dmgr and should come out without any error (in case of error, troubleshoot based on the message); verify the datasouce properties in admin console



This e-mail, including any attachments, may be confidential, privileged or otherwise legally protected. It is intended only for the addressee. If you received this e-mail in error or from someone who was not authorized to send it to you, do not disseminate, copy or otherwise use this e-mail or its attachments. Please notify the sender immediately by reply e-mail and delete the e-mail from your system.

Posted via email from shaker's posterous

Thursday, August 12, 2010

JACL script to change connection pool settings

Links: http://publib.boulder.ibm.com/infocenter/wasinfo/fep/topic/com.ibm.websphere....

Try creating a test datasource with required connection pool properties to test the script.

The script can be used to modify existing datasource or delete an existing datasource and create the same one with required values.

proc createjdbcds {cellName nodeName jdbcName jdbcDSName timeout max min reap unused aged} {

   #--------------------------------------------------------------

   # set up globals variables

   #--------------------------------------------------------------

        global AdminConfig

        global AdminApp

        set ds [$AdminConfig getid /Cell:$cellName/Node:$nodeName/JDBCProvider:$jdbcName/DataSource:$jdbcDSNam e/]      

        #set properties the connection pool

        set connectionPool [$AdminConfig list ConnectionPool $ds]

        set conTimeout [list connectionTimeout $timeout]

        set maxConn [list maxConnections $max]

        set minConn [list minConnections $min]

        set reapTime [list reapTime $reap]

        set unTimeout [list unusedTimeout $unused]

        set agedTimeout [list agedTimeout $aged]

        set purgePolicy [list purgePolicy "FailingConnectionOnly"]

        set fullArgs [list $conTimeout $maxConn $minConn $reapTime $unTimeout $agedTimeout $purgePolicy]

        $AdminConfig modify $connectionPool $fullArgs

        $AdminConfig save

}

#-----------------------------------------------------------------

# Main

#-----------------------------------------------------------------

if {($argc  10) } {

   puts "modifydsconnectionpool: this script requires at least six parameters: cellName nodeName jdbcName connectiontimeout maxcon mincon reaptime unusedtimeout agedtimeout"

   puts "e.g.:     modifydsconnectionpool mycell mynode SPSESS51JDBC SPSESS51DS 600 50 10 180 180 0"

} elseif {$argc == 10} {

   # do some checking

   set cellName [lindex $argv 0]

   set nodeName [lindex $argv 1]

   set jdbcName [lindex $argv 2]

   set jdbcDSName [lindex $argv 3]

   set timeout [lindex $argv 4]

   set max [lindex $argv 5]

   set min [lindex $argv 6]

   set reap [lindex $argv 7]

   set unused [lindex $argv 8]

   set aged [lindex $argv 9]

   createjdbcds $cellName $nodeName $jdbcName $jdbcDSName $timeout $max $min $reap $unused $aged

}



This e-mail, including any attachments, may be confidential, privileged or otherwise legally protected. It is intended only for the addressee. If you received this e-mail in error or from someone who was not authorized to send it to you, do not disseminate, copy or otherwise use this e-mail or its attachments. Please notify the sender immediately by reply e-mail and delete the e-mail from your system.

Posted via email from shaker's posterous

Wednesday, August 4, 2010

Sample Scripts for WebSphere Application Server

These sample jacl and Jython scripts let you automate common administation tasks and configure security in WebSphere Application Server Versions. The versions that the scripts apply to are noted. Download them and run them as is, or modify them to suit your environment.

  • The sample admin script and the script library package for the Feature Pack for Communications Enabled Applications run on WebSphere Application Server version 7.
  • The automated deployment sample runs on WebSphere Application Server versions 5.0, 5.1, and 6.0
  • The security configuration samples run on WebSphere Application Server Version 5 and WebSphere Application Server - Express, Version 5 and on WebSphere Application Server Version 6 and 6.1. There is one download that contains the samples for versions 5 and 5.1, one for version 6, and another for version 6.1.
  • The administration samples run on WebSphere Application Server versions 5.0, 5.1, and 6.0. (The Jython versions of the administration scripts only run on versions 5.1 and 6.0)
  • The configuration change samples run on version 5.1.1 and on version 6.

The hardware and software requirements for these samples are the same as for the products on which they run.

http://www.ibm.com/developerworks/websphere/library/samples/SampleScripts.html



This e-mail, including any attachments, may be confidential, privileged or otherwise legally protected. It is intended only for the addressee. If you received this e-mail in error or from someone who was not authorized to send it to you, do not disseminate, copy or otherwise use this e-mail or its attachments. Please notify the sender immediately by reply e-mail and delete the e-mail from your system.

Posted via email from shaker's posterous