Sun GlassFish Enterprise Server 2.1 High Availability Administration Guide

Configuring the JDBC Connection Pool

Enterprise Server communicates with HADB using the Java Database Connectivity (JDBC) API. The asadmin configure-ha-cluster command automatically creates a JDBC connection pool for use with HADB (for a cluster cluster-name ). The name of the connection pool is "cluster-name-hadb-pool". The JNDI URL of JDBC resource is "jdbc/cluster-name-hastore".

The initial configuration of the connection pool is normally sufficient. When you add a node, change the steady pool size so that there are eight connections for each HADB active node. See Adding Nodes.

This chapter covers the following topics:

For general information about connection pools and JDBC resources, see Sun GlassFish Enterprise Server 2.1 High Availability Administration Guide.

Getting the JDBC URL

Before you can set up the JDBC connection pool, you need to determine the JDBC URL of HADB using the hadbm get command as follows:

hadbm get JdbcUrl [dbname]

For example:

hadbm get JdbcUrl

This command displays the JDBC URL, which is of he following form:


Remove the jdbc:sun:hadb: prefix and use the host:port, host:port... part as the value of the serverList connection pool property, described in Table 3–10.

Creating a Connection Pool

The following table summarizes connection pool settings required for the HADB. Change the Steady Pool Size when adding nodes, but do not change other settings.

Table 3–9 HADB Connection Pool Settings


Required Value for HADB 


The HADB JDBC resource’s Pool Name setting must refer to this name 

Database Vendor

HADB 4.4 

Global Transaction Support


DataSource Classname


Steady Pool Size

Use 8 connections for each active HADB node. For more detailed information, see the System Deployment Guide.

Connection Validation Required


Validation Method


Table Name

Do not specify 

Fail All Connections


Transaction Isolation


Guarantee Isolation Level


The following table summarizes connection pool properties required for the HADB. Change serverList when adding nodes, but do not change other properties.

Table 3–10 HADB Connection Pool Properties




Name of the storeuser to use in the asadmin create-session-store command.


Password (storepassword ) to us in the asadmin create-session-store command.


JDBC URL of the HADB. To determine this value, see Getting the JDBC URL

You must change this value if you add nodes to the database. See Adding Nodes.


When false , as required, ensures that calls to Connection.getMetaData() make calls to the database, which ensures that the connection is valid.


When true , as required, improves performance by eliminating redundant commit and rollback requests and ignoring these requests if no transaction is open.


Maximum number of statements per open connection that are cached in the driver statement pool. Set this property to 20.

Example 3–5 Creating a Connection Pool

Here is an example asadmin create-jdbc-connection-pool command that creates an HADB JDBC connection pool:

asadmin create-jdbc-connection-pool
--user adminname --password secret 
--datasourceclassname com.sun.hadb.jdbc.ds.HadbDataSource
--property username=storename:password=secret456:serverList=
:cacheDatabaseMetaData=false:eliminateRedundantEndTransaction=true hadbpool

On Solaris, escape colon characters (:) within property values with double backslashes (\\). On Windows, escape colon characters (:) with single backslashes ( \).

Creating a JDBC Resource

The following table summarizes JDBC resource settings required for HADB.

Table 3–11 HADB JDBC Resource Settings




The following JNDI name is the default in the session persistence configuration: jdbc/hastore. You can use the default name or a different name.

You must also specify this JNDI name as the value of the store-pool-jndi-name Persistence Store property when you activate the availability service.

Pool Name

Select from the list the name (or ID) of the HADB connection pool used by this JDBC resource. For more information, see Configuring Network Redundancy

Data Source Enabled