Data access problems
WebSphere Application Server diagnostic tools provide services to help troubleshoot database connection problems. Additionally, the IBM website provides flexible searching capabilities for finding documented solutions to database-specific connection problems.
IBM recommends using the High Performance Extensible Logging (HPEL) log and trace infrastructure . We view HPEL log and trace information using the logViewer .
The following steps help quickly isolate connectivity problems.
- Browse the log files of the application server for clues.
By default, these files are...
- app_server_root/server/SystemErr.log
- app_server_root/server/SystemErr.log/SystemOut.log
- Browse the Helper Class property of the data source to verify that it is correct and that it is on the WAS class path. Mysterious errors or behavior might result from a missing or misnamed Helper Class name. If WAS cannot load the specified class, it uses a default helper class that might not function correctly with the database manager.
- Verify that the JNDI name of the data source matches the name used by the client attempting to access it. If error messages indicate that the problem might be naming-related, such as referring to the name server or naming service, or including error IDs beginning with NMSV, look at the topics, Naming related problems, and Troubleshooting the naming service component.
- Enable tracing for the resource adapter using the trace specification, RRA=all=enabled. Follow the instructions for dumping and browsing the trace output, to narrow the origin of the problem. See the topic, Enabling tracing.
For a comprehensive list of database-specific troubleshooting tips, see the WAS product support page. (Find the link at the end of this article.) In the Search Support field, type a database vendor name among your search terms. Select Solve a problem, then click Search.
Remember that we can always find Support references in the topic, Troubleshooting help from IBM, in this information center.
Currently this information center provides a limited number of troubleshooting tips for the following databases:
General data access problems
- An exception "IllegalConnectionUseException" occurs
- WTRN0062E: An illegal attempt to enlist multiple one phase capable resources has occurred.
- ConnectionWaitTimeoutException.
- com.ibm.websphere.ce.cm.StaleConnectionException: [IBM][CLI Driver] SQL1013N The database alias name or database name "NULL" could not be found. SQLSTATE=42705
- java.sql.SQLException: java.lang.UnsatisfiedLinkError:
- "J2CA0030E: Method enlist caught java.lang.IllegalStateException" wrapped in error "WTRN0063E: An illegal attempt to enlist a one phase capable resource with existing two phase capable resources has occurred" when attempting to execute a transaction.
- java.lang.UnsatisfiedLinkError:xaConnect exception when attempting a database operation
- "J2CA0114W: No container-managed authentication alias found for connection factory or data source datasource" when attempting a database operation
- An error is thrown if we use the ws_ant command to perform the database customization for Structured Query Language in Java on HP platforms
- Container-managed persistence (CMP) cannot successfully obtain the database access function as defined.
IllegalConnectionUseException
This error can occur because a connection obtained from a WAS40DataSource is being used on more than one thread. This usage violates the J2EE 1.3 programming model, and an exception generates when it is detected on the server. This problem occurs for users accessing a data source through servlets or bean-managed persistence (BMP) enterprise beans.
To confirm this problem, examine the code for connection sharing. Code can inadvertently cause sharing by not following the programming model recommendations, for example by storing a connection in an instance variable in a servlet, which can cause use of the connection on multiple threads at the same time.
WTRN0062E: An illegal attempt to enlist multiple one phase capable resources has occurred
This error can occur because:
- An attempt was made to share a one-phase connection but the getConnection calls do not all use the same connection properties; such as the AccessIntent property.
- An attempt was made to have more than one unshareable connection participate in a global transaction, when the data source is not an XA resource.
- An attempt was made to have a one-phase resource participate in a global transaction while an XA resource or another one-phase resource has already participated in this global transaction. The following information might help identify why the error condition is occurring:
- If we are using a non-XA data source and we are expecting to share a connection, set all of the relevant resource-refs to shareable. If we do not use a resource-ref, the default is set to unshareable connections.
- Your connection is not shared if we do not use the same connection properties, such as IsolationLevel or AccessIntent, on each connection request.
- Your connections might not be shared if we are using CMP beans that might be using different AccessIntent settings. To learn more about CMP beans sharing a connection with non-CMP components, see theinformation on extensions to data access APIs.
To correct this error:
- Check what the client code passes in with its getConnection requests, to ensure that they are consistent with each other.
- Check the connection sharing scope from the resource binding, using an assembly tool. See the topic, Assembly tools.
- If we are running an unshareable connection scope, verify that the data source is an XA data source.
- If we are running a shareable connection scope, verify that all connection properties, including AccessIntent, are shareable.
- Check the JDBC provider implementation class from the Manage JDBC resource panel of the administrative console to ensure that it is a class that supports XA-type transactions.
ConnectionWaitTimeoutException accessing a data source or resource adapter
If the application receives exceptions like a com.ibm.websphere.ce.cm.ConnectionWaitTimeoutException or com.ibm.websphere.ce.j2c.ConnectionWaitTimeoutException when attempting to access a WAS data source or JCA-compliant resource adapter, some possible causes are:
- The maximum number of connections for a given pool is set too low. The demand for concurrent use of connections is greater than the configured maximum value for the connection pool. One indication that this situation is the problem is that we receive these exceptions regularly, but your CPU utilization is not high. This exception indicates that there are too few connections available to keep the threads in the server busy.
- Connection Wait Time is set too low. Current demand for connections is high enough such that sometimes there is not an available connection for short periods of time. If our connection wait timeout value is too low, we might timeout shortly before a user returns a connection back to the pool. Adjusting the connection wait time can give you some relief. One indication of this problem is that we use close to the maximum number of connections for an extended period and receiving this error regularly.
- We are not closing some connections or we are returning connections back to the pool at a slow rate. This situation can happen when using unshareable connections, when you forget to close them, or you close them long after we are finished with them, keeping the connection from returning to the pool for reuse. The pool soon becomes empty and all applications get ConnectionWaitTimeoutExceptions. One indication of this problem is we run out of connections in the connection pool and we receive this error on most requests.
- We are driving more load than the server or backend system have resources to handle. In this case we must determine which resources we need more of and upgrade configurations or hardware to address the need. One indication of this problem is that the application server or the database server processor is nearly 100% busy.
To correct these problems, either:
- Modify an application to use fewer connections
- Properly close the connections.
- Change the pool settings of MaxConnections or ConnnectionWaitTimeout.
- Adjust resources and their configurations.
com.ibm.websphere.ce.cm.StaleConnectionException: [IBM][CLI Driver] SQL1013N The database alias name or database name "NULL" could not be found
com.ibm.websphere.ce.cm.StaleConnectionException: [IBM][CLI Driver] SQL1013N The database alias name or database name "NULL" could not be found. SQLSTATE=42705. This error occurs when a data source is defined but the databaseName attribute and the corresponding value are not added to the custom properties panel.
To add the databaseName property:
- Click Resources > Manage JDBC Providers in the administrative console.
- Select the JDBC_provider that supports the problem data source.
- Select Data Sources and then select the problem data source.
- Under Additional properties, click Custom Properties.
- Select the databaseName property, or add one if it does not exist, and enter the actual database name as the value.
- Click Apply or OK, and then click Save from the action bar.
- Access the data source again.
java.sql.SQLException: java.lang.UnsatisfiedLinkError
This error indicates that the directory containing the binary libraries which support a database are not included in the LIBPATH environment variable for the environment in which the WAS starts.
The path containing the DBM vendor libraries vary by dbm. One way to find them is by scanning for the missing library specified in the error message. Then we can correct the LIBPATH variable to include the missing directory, either in the.profile of the account from which WAS is started, or by adding a statement in a .sh file which then starts the startServer program.
(ZOS) Configure the Java LIBPATH (java.library.path) property with the domain_region_libpath environment variable, like control_region_libpath, server_region_libpath, adjunct_region_libpath. See the topic on changing the values of variables referenced in BBOM0001I messages for instructions on how to set the region libpath variables.
Error J2CA0030E wrapped in error WTRN0063E
"J2CA0030E: Method enlist caught java.lang.IllegalStateException" wrapped in error "WTRN0063E: An illegal attempt to enlist a one phase capable resource with existing two phase capable resources has occurred" when attempting to execute a transaction. This error can occur when last participant support is missing or disabled. Last participant support supports a one-phase capable resource and a two-phase capable resource to enlist within the same transaction.
Last participant support is only available if the following are true:
- WAS Programming odel Extensions (PME) is installed. PME is included in the Application Server Integration Server product.
- The Additional Integration Server Extensions option is enabled when PME is installed. If we perform a typical installation, this function is enabled by default. If we perform a custom installation, we can disable this function, which disables last participant support.
- The application enlisting the one-phase resource is deployed with the Accept heuristic hazard option enabled. This deployment is done with an assembly tool.
java.lang.UnsatisfiedLinkError:xaConnect exception when attempting a database operation
This problem has two main causes:
- The most common cause is that the JDBC driver that supports connectivity to the database is missing, or is not the correct version. Another common cause is the native libraries which support the driver are on the system path.
- To resolve this problem on a Windows platform, verify that the JDBC driver JAR file is on the system PATH environment variable:
- If we are using DB2, verify that at least the DB2 client product has been installed on the WebSphere host
- On DB2 version 7.2 or earlier, the file where the client product is installed on the WAS is db2java.zip. Verify that the usejdbc2.bat program has been executed after the database install and after any upgrade to the database product.
- On DB2 version 8.1 or later, use the DB2 Universal JDBC Provider Driver when defining a JDBC provider in WAS. The driver file is db2jcc.jar. If we use the type 2 (default) option, verify that at least the DB2 client product is installed on the WAS host. If we specify the type 4 option, the DB2 client does not need to be installed, but the file db2jcc.jar still must be present.
When specifying the location of the driver file, IBM recommends to specified the path and file name of the target DB2 installation, rather than copying the file to a local directory, if possible. Otherwise, we might be exposed to problems if the target DB2 installation is upgraded and the driver used by WAS is not.
- On operating systems such as AIX or Linux, ensure any native libraries required to support the database client of our database product are specified in the LD_LIBRARY_PATH environment variable in the profile of the account under which WAS starts.
If we are using DB2 The native library is libdb2jdbc.so. The best way to ensure that this library is accessed correctly by WebSphere is to call the db2profile script supplied with DB2 from the .profile script of the account (such as "root") under which WebSphere runs.
- If we are using DB2 version 7.2 or earlier, ensure that the usejdbc2,script provided with DB2 is called from the profile of the account under which WAS is launched.
- If we are using DB2 version 8.1 or later, see the previous instructions for the Windows operating system.
- If the database manager is DB2, we can choose the option to create a 64-bit instance. Sometimes a 64-bit configuration is not supported. If this has happened, remove the database instance and create one with the default 32-bit setting.
If we are using the Universal JDBC T2 driver, WAS does support interaction with a DB2 UDB 64-bit server, but it must be through a DB2 UDB 32-bit client. The WAS environment (CLASSPATH, and so on) must use the 32-bit client code to ensure correct function.
With a Universal JDBC T4 driver, we do not need the 32-bit DB2 client. You need only configure the class path to include db2jcc.jar and its license files in the WAS environment.
For general help in configuring JDBC drivers and data sources in WAS, see the topic, Access data from applications.
"J2CA0114W: No container-managed authentication alias found for connection factory or data source datasource" when attempting a database operation
This error might occur in the SystemOut.log file when we run an application to access a data source after creating the data source using JACL script.
The error message occurs because the JACL script did not set container-managed authentication alias for CMP connection factory. The JACL is missing the following line:
$AdminConfig create MappingModule $cmpConnectorFactory "{mappingConfigAlias DefaultPrincipalMapping} {authDataAlias $authDataAlias}To correct this problem, add the missing line to the JACL script and run the script again. See the topic, Example: Creating a JDBC provider and data source using Java Management Extensions API and the scripting tool, for a sample JACL script.
Error occurs when using the ws_ant command to perform the database customization for SQLJ on HP platforms
If we use the ws_ant command to perform the database customization for Structured Query Language in Java (SQLJ) on HP platforms, we can receive an error similar to the following:
[java] [ibm][db2][jcc][sqlj] [java] [ibm][db2][jcc][sqlj] Begin customization [java] [ibm][db2][jcc][sqlj] encoding not supported!!The cause of this error might be that the databases were created using the HP default character set. The Java Common Client (JCC) driver depends on the SDK to perform the code page conversions. The SDK shipped with this product, however, does not support the HP default code page.We must set your LANG to the ISO locale before creating the databases. It should be similar to the following:
export LANG=en_US.iso88591Refer to the IBM support site for Information Management software to access the latest technotes for DB2.
Container-managed persistence (CMP) cannot successfully obtain the database access function as defined
When WAS is caching certain generated code that is accessed in the database on the connection factory, and if any changes in the Java archive (JAR) file require regeneration of the database access, the changes are not effective until you stop and restart the server.
Examples of when this failure might occur include:
- Add an enterprise bean custom finder method; a NullPointerException exception is created.
- Update an enterprise bean custom finder method; the new SQL statement does not run.
- Change schema mapping; the new SQL statement does not run.
In summary, if we add or update an enterprise bean containing a custom finder method, we must stop and then restart the server.
Related:
Troubleshooting help from IBM Development and assembly tools (ZOS) Change the values of variables referenced in BBOM0001I messages Use High Performance Extensible Logging to troubleshoot applications View JVM logs Task overview: Access data from applications Extensions to data access APIs Application access problems Naming service troubleshooting tips Example: Create a JDBC provider and data source using Java Management Extensions API and the wsadmin scripting tool