wsadmin コマンドは、接続ファクトリーおよびデータ・ソース MBean にアクセスするために使用されます。 MBeans は接続ファクトリーまたはデータ・ソースのプロパティーを検索または更新できます。
wsadmin コマンド行から、J2C 接続ファクトリーまたはデータ・ソース Mbean オブジェクト名のリストを入手するために、以下の管理制御コマンドの 1 つを使用します。
$AdminControl queryNames *:type=J2CConnectionFactory,* $AdminControl queryNames *:type=DataSource,*
DataSource 照会からの出力例:
wsadmin>$AdminControl queryNames *:type=DataSource,* "WebSphere:name=Default Datasource,process=server1,platform=dynamicproxy,node= system1Node01,JDBCProvider=Cloudscape 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=Cloudscape JDBC Provider,cell=system1Node01Cell"
J2C 接続ファクトリーまたはデータ・ソース MBean オブジェクト名を 使用することによって、MBean へのアクセスが可能です。 名前には webSphere:name= 式が続きます。 以下の例では、最初のセットで、デフォルトのデータ・ソース名が変数名上に設定されます。 2 番目のセットで、オブジェクト名が変数 objectName 上に設定されます。
デフォルト・データ・ソースの使用例
- 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=Cloudscape 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=Cloudscape JDBC Provider,cell=system1Node01Cell"
これで、objectName を使用して、この Mbean で使用可能な属性および操作についてのヘルプを入手できるようになりました。
$Help attributes $objectName $Help operations $objectName
属性を入手または設定する、あるいは操作を使用するには、以下のコマンドの 1 つを使用します。
$AdminControl getAttribute $objectName "attribute name" $AdminControl setAttribute $objectName "attribute name" value $AdminControl invoke $objectName "operation"
以下に属性、操作の例を示します。
Get and set a attribute maxConnections (Note, 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 needs to 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 connection in free pool: 3 UnShared Connection information No unshared connections
wsadmin ツールを使用して showPoolContents を起動する Java プログ ラム例については、ShowPoolContents.Java コード を参照してください。