Java Reference
In-Depth Information
dependency. The properties for this transaction manager are handled differently,
based on what properties are available. The old way of setting up a DBCP transac-
tion manager (which is still supported) was to set these eight properties:
JDBC.Driver —This specifies the JDBC driver to be used by this DAO context.
JDBC.ConnectionURL —This is the JDBC URL to be used for connecting to
this DAO context's database.
JDBC.Username —This is the username to be used when connecting to the
database.
JDBC.Password —This is the password to be used when connecting to the
database.
Pool.ValidationQuery —This is a query to use to validate database connec-
tions.
Pool.MaximumActiveConnections —This specifies the maximum number of
active connections that are to be in the connection pool.
Pool.MaximumIdleConnections —This specifies the maximum number of
idle connections that are to be in the connection pool.
Pool.MaximumWait —This specifies the maximum time (in milliseconds) to
wait for a connection before giving up.
The new way of configuring the DBCP data source is much more flexible, because
it simply treats it as a bean, so that all properties exposed with get/set methods
are available for your use in i BATIS . For example, to set the driverClassName for
the data source, you would do this:
<property
name="driverClassName"
value="com.mysql.jdbc.Driver"/>
To learn more about using and configuring the DBCP data source, visit
the official website at the Jakarta project: http://jakarta.apache.org/
commons/dbcp/.
NOTE
The JNDI data source
The JNDI data source is intended to allow you to leverage any JNDI context that
your applications container may provide. It is also probably the simplest one to set
up. It has one required property, DBJndiContext , which provides the name of the
context that contains the data source.
Search WWH ::




Custom Search