The following examples demonstrate how to test the connection to a DataSource object in the WebSphere Application Server V4.0 and V6.x:
set myds /JDBCDriver:mydriver/DataSource:myds/ DataSource testConnection $myds
The testConnection command is part of the AdminControl object because it is an operational command. This particular type of operational command takes a configuration ID as an argument, so you invoke the getid command on the AdminConfig object:
set myds [$AdminConfig getid /JDBCProvider:mydriver/DataSource:mydatasrc/] $AdminControl testConnection $myds
myds = AdminConfig.getid('/JDBCProvider:mydriver/DataSource:mydatasrc/') AdminControl.testConnection(myds)
WASX7216E: 2 attributes required for testConnection are missing: "[user, password]" To complete this operation, please supply the missing attributes as an option, following this example: {{user user_val} {password password_val}}For this example, issue the following commands:
set myds [$AdminConfig getid /JDBCProvider:mydriver/DataSource:mydatasrc/] $AdminControl testConnection $myds {{user myuser} {password secret}}
myds = AdminConfig.getid('/JDBCProvider:mydriver/DataSource:mydatasrc/') AdminControl.testConnection(myds, [['user', 'myuser'], ['password', 'secret']])