Testing a connection with the administrative console

After you have defined and saved a data source, you can click the Test connection button to ensure that the parameters in the data source definition are correct.

Before you begin

For the Test connection button to be displayed, you must have one of the following roles.
  • Administrator
  • Configurator
  • Monitor, when the com.ibm.ws.console.test_connection_monitor custom property is set to true

About this task

You can select multiple data sources on the data source collection page and test them as a group. Be sure that the following conditions are met before using the Test connection button:

Procedure

  • If you are testing a connection using a WebSphere® Application Server Version 4.0 type of data source, ensure that the user and password information is set.
  • If a user name and password is required to access the database of the JDBC provider used by the datasource, you must configure it before testing the connection.
    The following authentication credentials may be used in conjunction with the test connection function and are used in the following order:
    • Component-managed authentication alias (if configured)
    • Container-managed authentication alias (if configured)
    • Custom datasource properties for user name and password (if configured)
    If one of the listed credential types is not configured, the order continues with the next type that is configured.
  • Designate variables appropriately.

    [AIX Solaris HP-UX Linux Windows]If you used a WebSphere environment entry for the class path or other fields, such as ${DB2_JDBC_DRIVER_PATH}/db2java.zip, make sure that you assign it a value in the WebSphere Variables page.

    [z/OS]If you used a WebSphere environment entry for the class path or other fields, such as ${DB2390_JDBC_DRIVER_PATH}/classes/db2j2classes.zip, make sure that you assign it a value in the WebSphere Variables page.

    [IBM i]
    • WebSphere Application Server automatically sets environment variables for Java™ database connectivity (JDBC) driver class paths on the IBM® i platform. Application Server names the variable according to your driver, either ${OS400_NATIVE_JDBC_DRIVER_PATH} or ${OS400_TOOLBOX_JDBC_DRIVER_PATH}. In the administrative console, you designate the complete path location of your driver as the value of the environment variable. See the JDBC provider settings for more information.
    • If you download the latest JTOpen version of the jt400.jar file, use one of two placement strategies to keep the value of your environment variable accurate. You can place the file in the same directory that you specify for the ${OS400_TOOLBOX_JDBC_DRIVER_PATH} variable. Alternatively, you can place the jt400.jar file in a different directory and change the value of ${OS400_TOOLBOX_JDBC_DRIVER_PATH} to this different path.
  • Verify that the environment variables exist in the scope of the test.
    For example, if the node scoped data source you defined uses ${DB2_JDBC_DRIVER_PATH}, ensure that there is a node level definition for DB2_JDBC_DRIVER_PATH = c:\sqllib\java or your system dependent value.
  • Restart the deployment manager and node agents after you define or edit WebSphere variables.
  • Restart the deployment manager and node agents after you create or edit an authentication alias for the data source.
  • Ensure that the deployment manager and node agent are up and running.
  • You can now test a connection to the data source. On the data source collection page in the administrative console, select the data source and click Test connection.
    A test connection operation can have three different outcomes, each resulting in a different message being displayed in the messages panel of the page on which you press the Test connection button.
    1. The test can complete successfully, meaning that a connection is successfully obtained to the database using the configured data source parameters. The resulting message states: Test Connection for data source DataSourceName on process ProcessName at node NodeName was successful.
    2. The test can complete successfully with warnings. This means that while a connection is successfully obtained to the database, warnings were issued. The resulting message states: Test Connection for data source DataSourceName on process ProcessName at node NodeName was successful with warnings. View the JVM Logs for more details.

      The View the JVM Logs text is a hyperlink that takes you to the JVM Logs console screen for the process.

    3. The test can fail. A connection to the database with the configured parameters is not obtained. The resulting message states: Test Connection failed for data source DataSourceName on process ProcessName at node NodeName with the following exception: ExceptionText. View the JVM Logs for more details.

      Again, the text for View the JVM Logs is a hyperlink to the appropriate logs screen.