The following example tests a dataSource, to ensure a connection to the database.
Using Jacl:
set dshelper [$AdminControl queryNames type=DataSourceCfgHelper,process=server1,*]
Example output:
WebSphere:cell=mycell,name=DataSourceCfgHelper, mbeanIdentifier=DataSourceCfgHelper, type=DataSourceCfgHelper,node=mynode,process=server1
Using Jacl:
$AdminControl invoke $dshelper testConnectionToDataSource "COM.ibm.db2.jdbc.DB2XADataSource db2admin db2admin {{databaseName sample}} /sqllib/java/db2java.zip en US"This example command invokes the testConnectionToDataSource operation on the MBean, passing in the classname, userid, password, database name, JDBC driver class path, language, and country.
Example output:
DSRA8025I: Successfully connected to DataSource
The Preferred Method
Instead of using the method testConnectionToDataSource , use the method testConnection and pass in the configuration ID of the data source. The testConnection method is not available in V5.0. The data source to be tested has to be saved in the master configuration.
set myds [$AdminConfig getid "/JDBCProvider:Sybase 12.0 JDBC Driver/DataSource:sybaseds/"]
$AdminControl invoke $dshelper testConnection $mydsTo aid in making a batch program, the command returns a value instead of a message. A return value of 0 means success. A return value of 1 - n means success, but with a number of warnings. If the process fails, you receive an exception message.