TIBCO BusinessEvents - Database Concepts (DBConcepts) - Usage of catalog functions Database.setCurrentConnection() and Database.unsetConnection()
book
Article ID: KB0073504
calendar_today
Updated On:
Products
TIBCO BusinessEvents Enterprise Edition
Description
For TIBCO BusinessEvents applications with DBConcepts enabled, the number of available database connections is configured in CDD file (Cluster area -> Database Concepts).
For each database operation the catalog function Database.setCurrentConnection() returns a connection of the pool to the worker thread. That connection marked as in use until Database.unsetConnection() has been called. That catalog function releases the database connection.
It is required to release the connection to avoid that all connections are in use. In that case an error reported. "java.lang.RuntimeException: Connections are unavailable, increase the max pool size or wait timeout Database may be disconnected"
Issue/Introduction
TIBCO BusinessEvents - Database Concepts (DBConcepts) - Usage of catalog functions Database.setCurrentConnection() and Database.unsetConnection()
Environment
All Operating Systems
Resolution
Each time when you execute Database.setCurrentConnection() the worker thread requests a new connection from pool. If the existing newer connection is not released before the old connection then the old connection remains open and cannot be closed. That behavior is related to the implementation - one connection per DB per thread.
To avoid scenario where you run out of DB Connections you can use the approach highlighted below.
To manage the connections, create a wrapper RuleFunction and call Database.setCurrentConnection() and Database.unsetConnection() in that RuleFunction only.