8.9. Practical JDBC usage in EJBs

Two strategies are widely used for handling JDBC connections in EJBs.

Connections are kept open Until very recently, this was the preferred approach: All the required connections are created when the EJB implementation instance is initialized and remain active for the life of the instance. With this strategy, the appropriate places to open and close connections are summarized in Table 8.1. This strategy has the advantage that it does not depend on the efficiency of the connection pooling algorithm for its effectiveness. It has two important disadvantages. First, the connection pooling system may not allow an arbitrarily large number of virtual connections. With stateful session EJBs in particular (which are ...

Get Applied Enterprise JavaBeans™ Technology now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.