Test Connection Button Fails for Cell level datasource
 Technote (troubleshooting)
 
Problem(Abstract)
The IBM WebSphere Application Server V5.0 administrative console Test Connection button does not function exactly as the actual application database connection does. This is also true of the connection testing function in wsadmin. The Test Connection Button uses some administrative service code to test the connection. In the case of Network Deployment (ND) Edition with a datasource created at the cell level, the Test Connection Button uses the JDBC driver files located on the Deployment Manager node. If the necessary JDBC JAR files are not located on that machine, an error similar to the following can occur. This example is for the embedded driver for Microsoft SQL Server, but this can occur for any database:

Test Connection failed for datasource <Your datasource> on server dmgr at
node <Your node> with the following exception: java.sql.SQLException:
java.lang.NoClassDefFoundError:
com/merant/datadirect/jdbc/extensions/ExtEmbeddedConnection.
 
Cause
JDBC driver files are not available on the dmgr node or the node where the administrative console application is running.
 
Resolving the problem
The easiest way to resolve the problem is to copy the JDBC driver files to the Deployment Manager machine. In some cases, it is not desirable to do this. The WebSphere Application Server Information Center includes the following recommendation on how to set up data sources in an Network Deployment environment:

http://publib.boulder.ibm.com/infocenter/ws51help/index.jsp?
topic=/com.ibm.websphere.nd.doc/info/ae/ae/tdat_mcrtpds.html


Creating a JDBC provider on multiple nodes

Why and when to perform this task

These are the instructions to create a JDBC provider in a Network Development (ND) environment. This sample configuration involves two Base nodes: node A and node B federated with Deployment Manager node C.

Steps for this task

  1. Open the administrative console.

  2. Click Resources > JDBC Providers.
    The default listing is at the node level.

  3. Leave the node text field blank and click Apply to change the scope to the cell level.

  4. Click New to create a new JDBC provider at the cell level.

    The classpath for your new JDBC provider will already be filled in, and part of that classpath will be specified using a symbolic variable, for example ${DB2390_JDBC_DRIVER_PATH}/classes/db2j2classes.zip . Leave it at the default.

  5. Finish creating the JDBC provider.

  6. Click Environment.

  7. Click Manage WebSphere Application Server Variables.

  8. For each node, select the symbolic variable used in the classpath of your JDBC provider, and provide a value that is appropriate for the selected node.

    For example, if the classpath of your JDBC provider uses the symbolic variable ${DB2390_JDBC_DRIVER_PATH}, you might supply the value /usr/lpp/db2 on one node and /usr/lpp/db2710 on another node, depending on where your DB2 390 installation is located.

  9. Click DB2_JDBC_DRIVER_PATH (this already exists by default). Here provide the path (in the value field) where db2java.zip exists on the selected node.

  10. Click Apply and save the changes.

This variable must be defined on each node under the cell.

The above configuration, however, does not always produce a positive result for the Test Connection Button, although it will work for your actual application. The reason it may not work is WebSphere Application Server could still look for the JDBC driver files on the dmgr machine as described in this portion of the Information Center:

http://publib.boulder.ibm.com/infocenter/wasinfo/v5r1/index.jsp?
topic=/com.ibm.websphere.nd.doc/info/ae/ae/tdat_verifycon.html

You can test your connection from the data source collection view or the data source details view. Access either view in the administrative console, and then select a connection from the list. Click the test connection button on the connection.

You must complete all the steps and restart the server before you test the connection. Neither the authentication data alias nor the WebSphere Application Server environment variables (in Version 5.0.1) are available before a server restart.

In the Network Deployment environment, your test connection results depend on the Java™ Virtual Machine (JVM) that was running when you created the data source. If you defined the data source at the cell level, the test connection occurs on the deployment manager (dmgr). If you defined the data source at the node or server level, the test connection occurs on the node agent. You must restart the dmgr or the node agent on which the data source was defined, to acquire new or updated JAAS authentication alias entries and environment variables.

In a default WebSphere Application Server installation, the database driver path environment variables as, for example, DB2_JDBC_DRIVER_PATH, are defined and initialized to NULL at the node level. If you create a cell level data source and add the environment variable note indicating the node level environment variable will override the cell level value, your test connection will validate the datasource; however, your application programs will not work because the path to the database driver files is NULL. Ensure your default WebSphere Application Server database driver path environment variables are deleted or set to suitable values.

The following table illustrates the combinations of data sources and related environment variables that can be tested:

Testing connections on different data source and environment variable combinations

Data sources Cell level variables Node level variables Server level variables
Cell level Ok Fail Fail
Node level Ok Ok Fail
Server level Ok Ok Ok
 
 
Cross Reference information
Segment Product Component Platform Version Edition
Application Servers Runtimes for Java Technology Java SDK
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > DB Connections/Connection Pooling
Operating system(s): Windows
Software version: 6.1
Software edition:
Reference #: 1191304
IBM Group: Software Group
Modified date: Sep 7, 2007