When an activity fails, what happens to the database connection?
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?
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.
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.
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