|
This is a reliable DataSource implementation, based on the pooling logic provided by DBCP and the configuration found in
Avalon's excalibur code.
This uses the normal java.sql.Connection object and
java.sql.DriverManager . The Configuration is like this:
<jdbc>
<pool-controller min="5" max="10" connection-class="my.overrided.ConnectionClass">
<keep-alive>select 1</keep-alive>
</pool-controller>
<driver>com.database.jdbc.JdbcDriver</driver>
<dburl>jdbc:driver://host/mydb</dburl>
<user>username</user>
<password>password</password>
</jdbc>
These configuration settings are available:
- driver - The class name of the JDBC driver
- dburl - The JDBC URL for this connection
- user - The username to use for this connection
- password - The password to use for this connection
- keep-alive - The SQL query that will be used to validate connections from this pool before returning them to the caller. If specified, this query MUST be an SQL SELECT statement that returns at least one row.
- max - The maximum number of active connections allowed in the pool. 0 means no limit. (default 2)
- max_idle - The maximum number of idle connections. 0 means no limit. (default 0)
- initial_size - The initial number of connections that are created when the pool is started. (default 0)
- min_idle - The minimum number of active connections that can remain idle in the pool, without extra ones being created, or zero to create none. (default 0)
- max_wait - The maximum number of milliseconds that the pool will wait (when there are no available connections) for a connection to be returned before throwing an exception, or -1 to wait indefinitely. (default -1)
- testOnBorrow - The indication of whether objects will be validated before being borrowed from the pool. If the object fails to validate, it will be dropped from the pool, and we will attempt to borrow another. (default true)
- testOnReturn - The indication of whether objects will be validated before being returned to the pool. (default false)
- testWhileIdle - The indication of whether objects will be validated by the idle object evictor (if any). If an object fails to validate, it will be dropped from the pool. (default false)
- timeBetweenEvictionRunsMillis - The number of milliseconds to sleep between runs of the idle object evictor thread. When non-positive, no idle object evictor thread will be run. (default -1)
- numTestsPerEvictionRun - The number of objects to examine during each run of the idle object evictor thread (if any). (default 3)
- minEvictableIdleTimeMillis - The minimum amount of time an object may sit idle in the pool before it is eligable for eviction by the idle object evictor (if any). (default 1000 * 60 * 30)
version: CVS $Revision: 494012 $ |