Working with JDBC Connection Pools
Optionally, the application server can validate connections before they are passed to applications. This validation allows the application server to automatically reestablish database connections if the database becomes unavailable due to network failure or database server crash. Validation of connections incurs additional overhead and slightly reduces performance.
Parameter | Description |
|
|
Connection Validation | Select the Required checkbox to enable connection validation. |
|
|
Validation Method | The application server can validate database connections in three ways: |
| |
| |
| by calling the con.getAutoCommit() and con.getMetaData() methods. |
| |
| connection.getAutoCommit() is used to retrieve the current state of |
| |
| This allows actual contact with the database to take place. |
| getAutomCommit()might or might not contact the database, depending on |
| the implementation. Actual physical connection will be wrapped for |
| different purposes, such as a connection pool. |
| Note – 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 a database table that are 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 combo box, 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 reestablish them. If you do not select the checkbox, then |
| individual connections are reestablished only when they are used. |
|
|
Allow Non Component Callers | Click this check box if you want to enable the pool for use by |
| |
|
|
4.Change transaction isolation settings.
Because a database is usually accessed by many users concurrently, one transaction might update data while another attempts to read the same data. The isolation level of a transaction defines the degree to which the data being updated is visible to other transactions. For details on isolation levels, refer to the documentation of the database vendor.
Chapter 3 • JDBC Resources | 49 |