This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
The problem we ran into was creating "Manager" classes from a Struts action class (a Singleton). The actual problem was that our connection count kept increasing even though we closed the connections. We could see the connection count climbing (in the Weblogic monitor) with each DAO access.
It seems that after the first action class did its thing with the database and then the next action class created some classes (DAOs), connections weren't being closed property. The code explicitly calls close on the connection, the result set and the statement.
Once we moved the instantiation of the manager classes to an EJB (and out of an action class), the problem went away. No more connection pooling issues.
Is an action class, therefore, a bad place to create objects which have connections the database via, say, connection pooling?