Question : Jython to modify JDBC Connection Pool Parameters

Can someone provide an example Jython script for modifying Connection Pool Parameters for a given datasource in WAS 7...

In my particular case datasources are configuresd at the cell level (ND environment).  I want to set the minConnections to 10 via a jython script.

Answer : Jython to modify JDBC Connection Pool Parameters

Well, since you haven't responded, I guess I also provide the code to changed the configured value... ;-)

Oops, I see an error in the code above... (sorry)

Line 26 should be:

if len( items ) == 0 :

NOT:

if len( items ) < 0 :

Oh, and another thing.  Since we are modifying an active resource attribute, the AdminConfig.save() in line is unnecessary.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
# Using one of the findNamedScopedType() routines from above...

cell = AdminConfig.list( 'Cell' );                     # This is presumed to be a singleton
dsName = ...                                           # The name of the specific DataSource
items = findNamedScopedType( 'DataSource', dsName, cell );

if len( items ) == 0 :
  print 'Specified DataSource not found. name="%s"' % dsName;
elif len( items ) > 1 :
  print 'Unique DataSource not found. Number found=%d' % len( items );
else :
  cp = AdminConfig.showAttribute( items[ 0 ], 'connectionPool' );
  AdminConfig.modify( cp, [ [ 'minConnections', '10' ] ] );
  AdminConfig.save();
  print 'minConnections set to 10';
Random Solutions  
 
programming4us programming4us