#### To create a JDBC connection pool

When creating the pool with the Admin Console, you are actually defining the aspects of a connection to a specific database.

###### Before You Begin

Before creating the pool, you must first install and integrate the JDBC driver. See To integrate a JDBC driver.

When creating the Create Connection Pools, certain data specific to the JDBC driver and the database vendor must be specified. Before proceeding, gather the following information:

- Database vendor name

- Resource type, such as `javax.sql.DataSource` (local transactions only), `java.sql.ConnectionPoolDataSource` (local transactions, possible performance improvements), and `javax.sql.XADataSource` (global transactions)

- Data source class name

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

1. Select the Common Tasks node, then click Create New JDBC Connection Pool.

   Note - You can also access the JDBC Connection Pool page by expanding the Resources node and the JDBC node, and selecting the Connection Pools node. Then from the New Connection Pool page, select New to create a new connection pool.

2. Specify the General Settings as follows:

   - Name: Specify a name for the pool.

   - Resource Type: Select a resource type from the drop-down menu. Choices include `javax.sql.XADataSource` (global transactions), `java.sql.ConnectionPoolDataSource` (local transactions, possible performance improvements), and `javax.sql.DataSource` (local transactions only).

   - Database Vendor: Select a vendor from the list provided in the drop-down menu.

3. Click Next.
4. Specify the additional General Settings as follows:

   - Datasource Classname: If the JDBC driver has a Datasource class for the resource type and database vendor specified in the previous page, then the value of the Datasource Classname field is provided.

   - Description: a text description of the connection pool.

5. Specify the Pool Settings as follows:

   - Initial and Minimum Pool Size: The minimum number of connections in the pool. This value also determines the number of connections placed in the pool when the pool is first created or when application server starts.

   - Maximum Pool Size: The maximum number of connections in the pool.

   - Pool Resize Quantity: When the pool scales up and scales down toward the maximum and minimum pool size respectively, it is resized in batches. This value determines the number of connections in the batch. Making this value too large delays connection creation and recycling; making it too small will be less efficient.

   - Idle Timeout: The maximum time in seconds that a connection can remain idle in the pool. After this time expires, the connection is removed from the pool.

   - Max Wait Time: The amount of time the application requesting a connection will wait before getting a connection timeout.

6. Specify the Connection Validation as follows:

   - Connection Validation: Check the Required checkbox to enable connection validation.

   - Validation Method: The application server can validate database connections in three ways: auto-commit, metadata, and table.

     - Auto-commit and metadata - The application server validates a connection by calling the `con.getAutoCommit()` and `con.getMetaData()` methods.

       Note - However, because many JDBC drivers cache the results of these calls, they do not always provide reliable validations. Check with the driver vendor to determine whether these calls are cached or not.

     - Table - The application queries the database table that is specified. The table must exist and be accessible, but it doesn't require any rows. Do not use an existing table that has a large number of rows or a table that is already frequently accessed.

   - Table Name: If you selected table from the Validation Method drop-down menu, then specify the name of the database table here.

   - On Any Failure: If you select the checkbox labelled Close All Connections, if a single connection fails, then the application server closes all connections in the pool and then reestablishes them. If you do not select the checkbox, then individual connections are reestablished only when they are used.

   - Allow Non-Component Callers: Enable the pool to be used by non-component callers such as Servlet Filters and Lifecycle modules.

   - Non-Transactional Connections: Enable to return non-transactional connections.

7. Specify the Transaction Isolation settings as follows:

   - Transaction Isolation: Makes it possible to select the transaction isolation level for the connections of this pool. If left unspecified, the connections operate with default isolation levels provided by the JDBC driver.

   - Isolation Level: Only applicable if the isolation level has been specified. If you select the Guaranteed checkbox, then all connections taken from the pool have the same isolation level. For example, if the isolation level for the connection is changed programmatically (with `con.setTransactionIsolation`) when last used, this mechanism changes the status back to the specified isolation level.

8. In the Additional Properties table, add the required properties, such as database name (URL), user name, and password.

   Because the properties vary with database vendor, consult the vendor's documentation for details.

9. Click Finish.

######

###### More Information

Equivalent asadmin command

`create-jdbc-connection-pool`

###### See Also

- To Set Up Database Access

- To integrate a JDBC driver

- To edit a JDBC connection pool

- To verify connection pool settings

- To delete a JDBC connection pool

- Chapter 3, JDBC Resources, in Sun Java System Application Server 9.1 Administration Guide