Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

This content has been archived and is no longer being updated.

Links may not function; however, this content may be relevant to outdated versions of the product.

Use the application server to manage database connection pools and avoid stale connections

Updated on October 19, 2020

Summary

The information in this article applies to all releases of Process Commander Version 5.x and 6.x..

Stale database connections can cause many problems. Various symptoms like the one shown in the example scenario indicate that a database connection is stale. In addition, there are occasions when A firewall between the application server and the database terminates idle connections; this condition can also trigger a stale connection error.

As a best practice, manage JDBC connection pooling from the application server to take advantage of advanced features provided by the application server. For example, all application servers provide a way to test the JDBC connection before it’s used at application runtime. Testing the connection allows you to avoid having stale connections. The capabilities provided by the application server for testing and managing database connection pools, including JDBC connection pools, are extremely efficient, reliable, and easy to use.

Example scenario: Stale connection between a DB2 UDB database and WebSphere Application Server

Symptom: The first run of an application with an activity calling the RDB-List method throws the error JDBC-Connection stale connection where the method RDB-List is first called. The next time the activity is called, the RDB-List method runs without error. On the initial invocation of the RDB-List method, the connection between the WebSphere Application Server and the DB2 Universal Database (UDB) database appears to drop, as indicated by one or more occurrences of the following error:

Problem #1, SQLState null, Error code 17002: com.ibm.websphere.ce.cm.StaleConnectionException: Io exception: Connection reset by peer: socket write error

Problem #2, SQLState null, Error code 17002: java.sql.SQLException: Io exception: Connection reset by peer: socket write error.

When the JDBC connection is stale, error messages like the following example can appear in the PegaRULES log:

2010-03-23 14:38:57,726 [ PegaRULES-Batch-1] ( engine.database.DatabaseImpl) ERROR - There was a problem with the database when getting a list:

com.pega.pegarules.pub.database.ConnectionException: Database-General Problem encountered when getting connection for database pegarules 17008 Closed Connection

From: (B3D7B434DFED49675B109F990BD4B6F09)

Caused by SQL Problems.

Problem #1, SQLState null, Error code 17008: com.ibm.websphere.ce.cm.StaleConnectionException: Closed Connection

Problem #2, SQLState null, Error code 17008: java.sql.SQLException: Closed Connection

at com.pega.pegarules.engine.database.ExceptionInformation.
createExceptionDueToDBFailure(ExceptionInformation.java:146)

at com.pega.pegarules.engine.database.ConnectionManager.getConnection(ConnectionManager.java:1108)

at com.pega.pegarules.engine.database.ConnectionManager.getConnection(ConnectionManager.java:783)

< . . . more, text omitted . . . >

Caused by:

com.pega.pegarules.pub.database.ConnectionException: Database-General Problem encountered when getting connection for database pegarules 17008 Closed Connection

Caused by SQL Problems.

Problem #1, SQLState null, Error code 17008: com.ibm.websphere.ce.cm.StaleConnectionException: Closed Connection

Problem #2, SQLState null, Error code 17008: java.sql.SQLException: Closed Connection

at com.pega.pegarules.engine.database.ExceptionInformation.

createExceptionDueToDBFailure(ExceptionInformation.java:146)

at com.pega.pegarules.engine.database.ConnectionManager.getConnection(ConnectionManager.java:1108) at com.pega.pegarules.engine.database.ConnectionManager.getConnection(ConnectionManager.java:783) at com.pega.pegarules.engine.database.ThreadConnectionStore.getConnection(ThreadConnectionStore.java:328)

at com.pega.pegarules.engine.database.RDBPageResultPackager.getConnection(RDBPageResultPackager.java:643) at com.pega.pegarules.engine.database.DatabaseImpl.list(DatabaseImpl.java:4072)

at com.pega.pegarules.engine.database.DatabaseImpl.executeRDB(DatabaseImpl.java:4406)

at com.pega.pegarules.engine.database.DatabaseImpl.deleteRDB(DatabaseImpl.java:3975)

at com.pegarules.generated.activity.ra_action_log_usage_usagecleaner_
3783b4b8e14a89a156df71ffc2757a81.step10_circum0(ra_action_log_usage_usagecleaner
_3783b4b8e14a89a156df71ffc2757a81.java:742)

< . . . 14 more . . . >

Caused by:

com.ibm.websphere.ce.cm.StaleConnectionException: Closed Connection

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:67)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:522)

at com.ibm.websphere.rsadapter.GenericDataStoreHelper.mapExceptionHelper(GenericDataStoreHelper.java:523) at com.ibm.websphere.rsadapter.GenericDataStoreHelper.mapException(GenericDataStoreHelper.java:578)

at com.ibm.ws.rsadapter.jdbc.WSJdbcUtil.mapException(WSJdbcUtil.java:903)

at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.setAutoCommit(WSJdbcConnection.java:2673)

at com.pega.pegarules.engine.database.DatabaseConnection.setAutoCommit(DatabaseConnection.java:546) at com.pega.pegarules.engine.database.ConnectionManager.getConnection(ConnectionManager.java:1083)

< . . . 21 more . . . >

 

 

Suggested Approach

Take the following actions to troubleshoot and resolve a stale JDBC connection:

  1. Check the PegaRULES log for errors indicating a closed connection.
  2. Manage JDBC connection pooling from the application server, not from Process Commander.
  3. Test the JDBC connection using the test connection feature provided by the application server before giving the connection to the application.

For complete information about managing JDBC connections from the application server, refer to the cited reference for the application server you are using for your Process Commander environment.

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us