Test a connection using wsadmin
Overview
The AdminControl object of wsadmin has a testConnection operation that tests the configuration properties of a data source object. It takes a configuration ID as an argument.Note: There is no way to pass a user ID and password to this invocation. This invocation can only be used for databases that do not require a user ID and password to make a connection (such as DB2 on a Windows machine), or for data sources that have a component-managed or container-managed authentication alias set on the data source object.
Procedure
- Invoke the getid() method for your data source.
- Set the value of the configuration id to a variable.
where /JDBCProvider:mydriver/DataSource:mydatasrc/ is the data source you want to test. After you have the configuration ID of the data source, one can test the connection to the database.set myds [$AdminConfig getid /JDBCProvider:mydriver/DataSource:mydatasrc/]- Test the connection to the database.
$AdminControl testConnection $myds
See Also
Test connection service
Related Tasks
Testing a connection with the administrative console
See Also
Example: Test a connection using testConnection(ConfigID)