Avatar of WAS
Flag for United States of America asked on

jython script to modify min and max connection pool in given datasource at cluster level

Please provide a jython script to modify min and max connection pool in given datasource at cluster level

cell name : ABC
Cluster:  EFG

Datasource            Current Max            New Max
Eclipse                                32                  42
Tata                                 32                  42
papa                           32                  42

Avatar of undefined
Last Comment

8/22/2022 - Mon

Something like this perhaps?

Invoke without parameters to display the usage information:

Command: poolMod

Purpose: WebSphere (wsadmin) script used to modify the min/max connection
         pool setting for a specified datasource.

  Usage: poolMod [options]

Required switches:
  -L | --cluster    <name> = Name of specific cluster
  -d | --dataSource <name> = Name of DataSource to be viewed / modified

Optional switches:
  -m | --minConn    #      = Minimum # of connections
  -x | --maxConn    #      = Maximum # of connections

- Long form option values may be separated/delimited from their associated
  value using either a space, or an equal sign ('=').

- Short form option values may be sepearated from their associated value using
  an optional space.

- Description text containing blanks should be enclosed in double quotes.

  wsadmin -lang jython -f poolMod.py --cluster=C1 --dataSource myDS

  wsadmin -lang jython -f poolMod.py -LC1 -d myDS

Open in new window

If you only specify a cluster and datasource names, the current connection pool settings are displayed


can you hardcode the clustername and cell name into the script, i don't want to pass the values, also this script looks way too complicated and too big, is it possible for you to write small and easy to understand and maintain like if i want to change anything in the future .

Below is an example for creating workmanager in a cluster, where the  clustername and cellname are hardcoded in the script and very small and easy to understand and easy to modify. I used this as a template to create timermanger in WAS6.1 :)

print 'begin script'

cell_name = "was_cell"
cluster_name = "kaka"

cell = '/Cell:' + cell_name
#node = cell + '/Node:' + node_name
ServerCluster = cell + '/ServerCluster:' + cluster_name

import java
# WorkManager info begin

def add_wm():
  wm_provider=AdminConfig.getid(ServerCluster + '/WorkManagerProvider:WorkManagerProvider')
  AdminConfig.create('WorkManagerInfo', wm_provider, [['name', 'kakaWorkManager'], ['jndiName', 'wm/kakaWorkManager'], ['numAlarmThreads', '5'], ['minThreads', '1'], ['maxThreads', '20'], ['threadPriority', '5'], ['isGrowable', 'off']])


print 'Done setting up WM'

print 'Saving changes..'


print 'SUCCESS'

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

Thank you honorgod
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.

You are very welcome.

Thanks for the grade & points.

Good luck & have a great day.