The iBATIS documentation already provides information about configuring a DBCP-datasource, however, the implementation has been improved in the meantime to allow for more flexibility. The old (legacy) configuration is still supported, so if your needs are satisfied with the options mentioned in the documentation, read no further.
The old implementation uses the prefix 'Pool.' to pass settings to DBCP, these are hardcoded and are: ValidationQuery, MaximumActiveConnections, MaximumIdleConnections and MaximumWait. The following example illustrates the prefix:
旧版本的dbcp使用方式
<dataSource type="DBCP">
<property name="JDBC.Driver" value="${driver}"/>
<property name="JDBC.ConnectionURL" value="${url}"/>
<property name="JDBC.Username" value="${username}"/>
<property name="JDBC.Password" value="${password}"/>
<property name="Pool.MaximumActiveConnections" value="10"/>
</datasource>
To achieve the same and more, use the new implementation, it uses Bean-style settings:
新版本的配置
<dataSource type="DBCP">
<property name="driverClassName" value="${driver}"/>
<property name="url" value="${url}"/>
<property name="username" value="${username}"/>
<property name="password" value="${password}"/>
<property name="maxActive" value="10"/>
<property name="initialSize" value="5"/>
<property name="Driver.SetBigStringTryClob" value="true"/>
</datasource>
Notice the use of the property 'initialSize', this one could not be specified in the previous configuration. Additional driver-specific properties can now be specified too, these have to be prefixed with 'Driver.' (see example).
An exhaustive listing of all available properties can be found at the Commons DBCP projectsite: http://jakarta.apache.org/commons/dbcp/configuration.html