Example: Migrating - Testing the DataSource object connection
The following examples demonstrate how to test the connection to a DataSource object in the WebSphere Application Server V4.0 and V5.0:
- wscp V4.0
set myds /JDBCDriver:mydriver/DataSource:myds/ DataSource testConnection $myds- wsadmin V5.0
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 $mydsIn many cases, a user ID and password, or other properties are required to complete the test connection. If this is the case, you receive the following message, which describes the missing properties: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}}