Working with JDBC Connection Pools

Working with JDBC Connection Pools

A JDBC connection pool is a group of reusable connections for a particular database. When creating the pool with the Admin Console, the Administrator is actually defining the aspects of a connection to a specific database.

Before creating the pool, you must first install and integrate the JDBC driver. When building the Create Connection Pool pages, certain data specific to the JDBC driver and the database vendor must be entered. Before proceeding, gather the following information:

Database vendor name

Resource type, such as javax.sql.DataSource (local transactions only) javax.sql.XADataSource (global transactions)

Data source class name

Required properties, such as the database name (URL), user name, and password

Creating a JDBC Connection Pool

You can use the Admin Console for creating the JDBC connection pool.

Creating a JDBC Connection Pool and JDBC Resource Using the Admin Console

1Copy the JDBC driver for database connectivity to as-install/domains/domain_name/lib/ext. Alternatively, add the path to the JDBC driver to classpath-prefixand restart the server.

2In the Admin Console, click Create JDBC Connection Pool in the Common Tasks page.

3Provide a name for the connection pool, select the resource type, select the database vendor. Click Next.

4The Admin Console lists the default pool settings and the properties of datasource class provided by the vendor.

5Click the Ping button to test the JDBC connection pool.

6In the left-hand pane of the Admin Console, click Resources > JDBC Resources.

7Click New.

8In the New JDBC Resource page, provide the JNDI name for the resource and the JDBC comnnection pool with which the JDBC resource needs to be associated.

46

Sun GlassFish Enterprise Server 2.1 Administration Guide • December 2008

Page 46
Image 46
Sun Microsystems 820433510 manual Working with Jdbc Connection Pools, Creating a Jdbc Connection Pool