LinkedIn
Copied!

Table of Contents

When an activity fails, what happens to the database connection?

Question

A developer asks: An activity in our application fails and produces a Java stack trace in the PegaRULES log. The failure is not related to the PegaRULES database connection. Is the database connection still available for the next activity call? How do we determine the status of the database connection?

Answer

In most cases, the database connection is available to other requestors. For example, if you are using IBM WebSphere Application Server to pool your connections, when an exception occurs and the thread terminates, the database connection is closed and returned to the connection pool for reuse.

If the thread does not terminate and the exception is not related to the database, then the connection may still be available to your thread. This possibility, however, depends on factors such as the DBMS, JDBC Driver, JVM, and application server that you are using.

Best Practices

The best practice for Version 5.x and later releases is to use connection pooling at the application server level, instead of using the connection pooling provided by Process Commander, as explained in the related topic cited below.

To learn more about the lifecycle of database connections managed by connection pooling with supported application servers, refer to the references cited below.

Additional Information

 Apache Tomcat 5.5 Servlet/JSP Container, JNDI Datasource How To Examples, Database Connection Pool (DBCP) Configurations

 Oracle's WebLogic server, Configuring JDBC Data Sources

 WebSphere Application Server, Version 6.1, Developing and deploying applications, Developing WebSphere applications, Data access resources, Task overview: Accessing data from applications, Connection management architecture, Connection pooling

 

Suggest Edit
Did you find this content helpful?

Have a question? Get answers now.

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