You can use the wsadmin scripting tool to change connection pool settings.
The wsadmin tool runs scripts. You can use the wsadmin tool to manage a WebSphere® Application Server installation and configuration, application deployment, and server runtime operations. The product supports the Jacl and Jython scripting languages. To learn more about the wsadmin tool see the topic Starting the wsadmin scripting client.
To use the wsadmin tool to change connection pool settings:
Example: Changing connection pool settings with the wsadmin tool. Using the wsadmin AdminControl object, you can script changes to connection pool settings.
The wsadmin tool runs scripts in the Jacl and Jython languages only. You must start the wsadmin scripting client to perform any scripting task. For more information, see the topic Starting the wsadmin scripting client.
For more information about the AdminControl scripting object, see the topic Using the AdminControl object for scripted administration.
Connection TimeoutThe Connection timeout can be changed at any time while the pool is active. All connection requests that are waiting for a connection are changed to the new value minus the time already waited, and are returned to the wait state if there are no available connections.
For example, if the connection timeout is changed to 300 seconds and a connection request has waited 100 seconds, the connection request waits for 200 more seconds if no connection becomes available.
$AdminControl getAttribute $objectname connectionTimeout $AdminControl setAttribute $objectname connectionTimeout 200
For more information about this setting, see the topic Connection pool settings. .
Maximum ConnectionsThe maximum connections can be changed at any time except in the case where stuck connection support is active.
If stuck connection support is active, an attempt to change the maximum connections is made. If the attempt fails, an IllegalState exception occurs. See the topic Connection pool advanced settings for more information.
If stuck connection support is not active, the maximum connections are changed to the new value. If the new value is greater than the current value, the number of connections increases to the new value and any requests waiting are notified. If the new value is less than the current value and Aged Timeout or Reap Time is used, the number of connections decreases to the new value depending on pool activity. If agedTimeout or Reap Time are not used, no automatic attempt made to reduce the total number of connections. To manually reduce the number of connections to the new maximum connections, use the Mbean function purgePoolContents.
$AdminControl getAttribute $objectname maxConnections $AdminControl setAttribute $objectname maxConnections 200
For more information about this setting, see the topic Connection pool settings.
Minimum ConnectionsThe minimum connections can be changed at any time.
$AdminControl getAttribute $objectname minConnections $AdminControl setAttribute $objectname minConnections 200
For more information about this setting, see the topic Connection pool settings.
Reap TimeThe reap time can be changed at any time. The reap time interval is changed to the new value at the next interval.
$AdminControl getAttribute $objectname reapTime $AdminControl setAttribute $objectname reapTime 30Unused Timeout
The unused timeout can be changed at any time.
$AdminControl getAttribute $objectname unusedTimeout $AdminControl setAttribute $objectname unusedTimeout 900
For more information about this setting, see the topic Connection pool settings.
Aged TimeoutThe Aged Timeout can be changed at any time.
$AdminControl getAttribute $objectname agedTimeout $AdminControl setAttribute $objectname agedTimeout 900
For more information about this setting, see the topic Connection pool settings.
Purge PolicyThe purge policy can be changed at any time.
$AdminControl getAttribute $objectname purgePolicy $AdminControl setAttribute $objectname purgePolicy "Failing Connection Only"
For more information about this setting, see the topic Connection pool settings.
Surge Protection SupportSurge connection support starts if surgeThreshold is > -1 and surgeCreationInterval is > 0. The surge protection properties can be changed at any time.
$AdminControl getAttribute $objectname surgeCreationInterval $AdminControl setAttribute $objectname surgeCreationInterval 30 $AdminControl getAttribute $objectname surgeThreshold $AdminControl setAttribute $objectname surgeThreshold 15
For more information about this setting, see the topic Connection pool settings.
Stuck connection SupportAn attempt is made to change the stuckTime, stuckTimerTime or stuckThreshold properties. If the attempt fails, an IllegalState exception occurs. The pool cannot have any active requests or active connections during this request. For the stuck connection support to start, all three stuck property values must be greater than 0, and the maximum connections value must be > 0.
If the connection pool is stuck, you cannot change the stuck or the maximum connection properties. If you are stuck, there are active connections.
$AdminControl getAttribute $objectname stuckTime $AdminControl setAttribute $objectname stuckTime 30 $AdminControl getAttribute $objectname stuckTimerTime $AdminControl setAttribute $objectname stuckTimerTime 15 $AdminControl getAttribute $objectname stuckThreshold $AdminControl setAttribute $objectname stuckThreshold 10
For more information about this setting, see the topic Connection pool advanced settings.
Test Connection Support (This is only supported for a DataSource)The test connection support starts when the testConnection property is set to true, and the interval is > 0. The test connection properties can be changed at any time.
$AdminControl getAttribute $objectname testConnection $AdminControl setAttribute $objectname testConnection 30 $AdminControl getAttribute $objectname testConnectionInterval $AdminControl setAttribute $objectname testConnectionInterval 15
For more information about this setting, see the topic Test connection service.
Connection Pool Partition Support$AdminControl invoke $objectname freePoolDistributionTableSize $AdminControl invoke $objectname numberOfFreePoolPartitions $AdminControl invoke $objectname numberOfSharedPoolPartitions $AdminControl invoke $objectname gatherPoolStatisticalData $AdminControl invoke $objectname enablePoolStatisticalData
For more information about this setting, see the topic Connection pool settings.
Show Pool Information SupportThe show pool operations can be changed at any time.
$AdminControl invoke $objectname showAllPoolContents $AdminControl invoke $objectname showPoolContents $AdminControl invoke $objectname showAllocationHandleListPurge Connection Support
PurgePool can be changed at any time.
$AdminControl invoke $objectname purgePoolContents normal $AdminControl invoke $objectname purgePoolContents immediate
Pause and resume can be changed at any time.
$AdminControl invoke $objectname pause $AdminControl invoke $objectname resumeExample: Accessing MBean connection factory and data sources using wsadmin
Wsadmin commands are used to access connection factory and data source MBeans. MBeans can retrieve or update properties for a connection factory or data source.
To get a list of J2C connection factory or data source Mbean object names, from the wsadmin command-line use one of the following administrative control commands:
$AdminControl queryNames *:type=J2CConnectionFactory,* $AdminControl queryNames *:type=DataSource,*
Example output from DataSource query:
wsadmin>$AdminControl queryNames *:type=DataSource,* "WebSphere:name=Default Datasource,process=server1,platform=dynamicproxy,node= system1Node01,JDBCProvider=Derby JDBC Provider,j2eeType=JDBCDataSource,J2EESe rver=server1,Server=server1,version=6.0.0.0,type=DataSource,mbeanIdentifier=cell s/system1Node01Cell/nodes/system1Node01/servers/server1/resources.xml#DataSource _1094760149902,JDBCResource=Derby JDBC Provider,cell=system1Node01Cell"
By using the J2C connection factory or data source MBean object name, you can access the MBean. The name follows the webSphere:name= expression. In the following example, for the first set, the default data source name is set on variable name. For the second set, the object name is set on variable objectName.
Example using the Default DataSource:
- wsadmin>set name [list Default Datasource] Default Datasource - wsadmin>set objectName [$AdminControl queryNames *:name=$name,*] "WebSphere:name=Default Datasource,process=server1,platform=dynamicproxy,node= system1Node01,JDBCProvider=Derby JDBC Provider,j2eeType=JDBCDataSource,J2EESe rver=server1,Server=server1,version=6.0.0.0,type=DataSource,mbeanIdentifier=cell s/system1Node01Cell/nodes/system1Node01/servers/server1/resources.xml#DataSource _1094760149902,JDBCResource=Derby JDBC Provider,cell=system1Node01Cell"
Now you can use the objectName for getting help on attributes and operations available for this Mbean.
$Help attributes $objectName $Help operations $objectName
To get or set an attribute or to use an operation, use one of the following commands:
$AdminControl getAttribute $objectName "attribute name" $AdminControl setAttribute $objectName "attribute name" value $AdminControl invoke $objectName "operation"
Attribute, operation examples:
Get and set an attribute maxConnections. If you get no value, a null value, or a java.lang.IllegalStateException, the connection factory or data source for this MBean has not been created. The connection factory or data source is created at first JNDI lookup. For this example, the Default DataSource must be used before get, set and invoke will work. wsadmin>$AdminControl getAttribute $objectName maxConnections 10 wsadmin>$AdminControl setAttribute $objectName maxConnections 20 wsadmin>$AdminControl getAttribute $objectName maxConnections 20 Using invoke wsadmin>$AdminControl invoke $objectName showPoolContents PoolManager name:DefaultDatasource PoolManager object:746354514 Total number of connections: 3 (max/min 20/1, reap/unused/aged 180/1800/0, connectiontimeout/purge 1800/EntirePool) (testConnection/inteval false/0, stuck timer/time /threshold 0/0/0, surge time/connections 0/-1) Shared Connection information (shared partitions 200) No shared connections Free Connection information (free distribution table/partitions 5/1) (2)(0)MCWrapper id 5c6af75b Managed connection WSRdbManagedConnectionImpl@4b5 a775b State:STATE_ACTIVE_FREE (2)(0)MCWrapper id 3394375a Managed connection WSRdbManagedConnectionImpl@328 5f75a State:STATE_ACTIVE_FREE (2)(0)MCWrapper id 4795b75a Managed connection WSRdbManagedConnectionImpl@46a 4b75a State:STATE_ACTIVE_FREE Total number of connections in free pool: 3 UnShared Connection information No unshared connections
In this information ...Related reference
| IBM Redbooks, demos, education, and more(Index) |