Link to home
Start Free TrialLog in
Avatar of WAS
WASFlag 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 HonorGod
HonorGod
Flag of United States of America image

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

Notes:
- 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.

Examples:
  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
poolMod.py
Avatar of WAS

ASKER

HonorGod,

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']])
  AdminConfig.save()

add_wm();

print 'Done setting up WM'

print 'Saving changes..'

AdminConfig.save()

print 'SUCCESS'
ASKER CERTIFIED SOLUTION
Avatar of HonorGod
HonorGod
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of WAS

ASKER

Thank you honorgod
You are very welcome.

Thanks for the grade & points.

Good luck & have a great day.