3.2 Setting Connection Pool Properties for UCP

UCP JDBC connection pools are configured using connection pool properties. The properties have get and set methods that are available through a pool-enabled data source instance. The methods are a convenient way to programmatically configure a pool. If no pool properties are set, then a connection pool uses default property values.

The following example demonstrates configuring connection pool properties. The example sets the connection pool name and the maximum/minimum number of connections allowed in the pool.

PoolDataSource  pds = PoolDataSourceFactory.getPoolDataSource();

pds.setConnectionPoolName("JDBC_UCP");
pds.setMinPoolSize(4);pds.setMaxPoolSize(20);

UCP JDBC connection pool properties may be set in any order and can be dynamically changed at run time. The pool recognizes the new values dynamically and adapts accordingly. However, this adaptation may not be immediate and may take some time to reflect. For example, if you reduce the value of the maximum pool size on a running pool, while all the connections are in use, then it may take some time for the new maximum pool size to come into effect.