Relational databases are by far the most widely used resources in enterprise applications. Besides supporting the JDBC API, Java EE further simplifies the configuration and management of database resources.
At runtime, the following sequence occurs when an application connects to a database:
The application gets the JDBC resource (data source) associated with the database by making a call through the JNDI API. Using the JNDI name of the resource, the naming service locates the JDBC resource. Each JDBC resource specifies a connection pool.
Using the JDBC resource, the application gets a database connection. GlassFish Server retrieves a physical connection from the connection pool that corresponds to the database. The pool defines connection attributes such as the database name (URL), username, and password.
Once the database connection is obtained, the application can read, modify, and add data to the database by making calls to the JDBC API. The JDBC...