Test a connection using wsadmin


The AdminControl object of wsadmin has a testConnection operation that tests the configuration properties of a data source object using a configuration ID as an argument.

This invocation is currently supported only for databases that do not require a user ID and password to make a connection, such as DB2 on a Windows NT machine.

  1. Invoke the getid method for your data source.

  2. Set the value of the configuration id to a variable.

    set xDS [$AdminConfig getid /JDBCProvider:MyJDBC/DataSource:MyDataSource/] 
    where /JDBCProvider:mydriver/DataSource:mydatasrc/ is the data source you want to test. After you have the configuration ID

  3. Test the connection to the database

    $AdminControl testConnection $myds