Testing a connection using wsadmin

The AdminControl object of wsadmin has a testConnection operation that tests the configuration properties of a data source object.

Before you begin

[Version 6.0] Restriction: In a network deployment configuration, you cannot test connections for the following data sources if they are defined at a node scope. You can create node-scoped configurations of the data sources for application use; these configurations work properly at run time. You can only use the testConnection command on the following data sources if they are server-scoped:
  • DB2 for z/OS Local JDBC Provider (RRS) data source (using driver type 2)
  • DB2 Universal JDBC Driver Provider data source with driver type 2
The Application Server issues the following exception for the testConnection command on a node-scoped data source:
java.sql.SQLException: Failure in loading T2 native library db2jcct2DSRA0010E: SQL state = null, Error Code = -99,999
For testing purposes, when you create these data sources at the node scope you will need to create the same configurations at the server scope. Run the test connection operation on the server-scoped data source to determine if the settings are valid for the overall configuration.

About this task

The testConnection operation takes a data source configuration ID as an argument.
Note: This invocation cannot accept user IDs and passwords that must be defined in the database itself. 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

  1. Invoke the getid() method for your data source.
  2. Set the value of the configuration id to a variable.
    set myds [$AdminConfig getid /JDBCProvider:mydriver/DataSource:mydatasrc/] 
    where /JDBCProvider:mydriver/DataSource:mydatasrc/ is the data source you want to test. After you have the configuration ID of the data source, you can test the connection to the database.
  3. Test the connection to the database.
    $AdminControl testConnection $myds



In this information ...


Related concepts

IBM Redbooks, demos, education, and more

(Index)

Use IBM Suggests to retrieve related content from ibm.com and beyond, identified for your convenience.

This feature requires Internet access.

Task topic    

Terms of Use | Feedback

Last updated: Aug 29, 2010 8:25:23 PM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=vela&product=was-nd-zos&topic=testcon1
File name: tdat_testcon1.html