Prev | Next

TOC | Index

J2EETM Developer's Guide
Database Connections


Chapter 5

Database Connections


The EJB container maintains the pool of database connections. This pool is transparent to the enterprise beans. When an enterprise bean requests a connection, the container fetches one from the pool and assigns it to the bean. Because the time-consuming connection has already been made, the bean quickly gets a connection. The bean may release the connection after each database call, since it can rapidly get another connection. And because such a bean holds the connection for a short time, the same connection may be shared sequentially by many beans.

The persistence type of the enterprise bean determines whether or not you code the connection routine. You must code the connection for enterprise beans that access a database and do not have container-managed persistence. Such beans include entity beans with bean-managed persistence and session beans. For entity beans with container-managed persistence, the Application Deployment Tool generates the connect routines for you.



Prev | Next

TOC | Index


Copyright © 2000 Sun Microsystems, Inc. All rights reserved.