Java Reference
In-Depth Information
In addition to those required properties, eight optional properties can be used to
configure the connection pool:
Pool.MaximumActiveConnections —This is the number of connections that
the pool can have active at one time. The default value of this property is 10
connections.
Pool.MaximumIdleConnections —This specifies the number of connections
that the pool can have idle at one time. The default value of this property
is 5 connections.
Pool.MaximumCheckoutTime —This is the maximum number of milliseconds
that a connection is reserved before it can be given to another request. The
default value of this property is 20,000 milliseconds, or 20 seconds.
Pool.TimeToWait —This represents the number of milliseconds to wait for a
connection if one is not available when requested. The default value of this
property is 20,000 milliseconds, or 20 seconds.
Pool.PingEnabled —If true (or any expression that the Boolean class in Java
interprets as true), then connections will be tested using the query defined
in the Pool.PingQuery property when they are determined to be at risk for
invalidation. The default value for this property is false , meaning that con-
nections will never be pinged before use. The next three properties are
used to determine the behavior of connection pinging.
Pool.PingQuery —This is the query to be executed if a connection needs to
be tested to see if it is still valid. Be sure to make this a statement that will
return very quickly. For example, on Oracle, something like select 0 from
dual would work very well.
Pool.PingConnectionsOlderThan —This represents the age (in millisec-
onds) at which connections are considered to be at risk for invalidation.
The default value for this property is 0, which means that if pinging is
enabled, then every time a connection is used it will be checked. In a high-
transaction environment, this could have a serious impact on performance.
Pool.PingConnectionsNotUsedFor —This is the number of milliseconds to
let a connection sit idle before considering it “at risk” for invalidation.
The DBCP data source
The DBCP data source is a wrapper around the Jakarta Commons Database Con-
nection Pooling ( DBCP ) project's data source implementation, and is intended to
allow you to use a more robust implementation at the expense of an added
Search WWH ::




Custom Search