Parameter |
Description |
username |
The connection username to be passed to our JDBC driver to establish a connection. |
password |
The connection password to be passed to our JDBC driver to establish a connection. |
url |
The connection URL to be passed to our JDBC driver to establish a connection. |
driverClassName |
The fully qualified Java class name of the JDBC driver to be used. |
connectionProperties |
The connection properties that will be sent to our JDBC driver when establishing new connections.
Format of the string must be [propertyName=property;]*
NOTE - The "user" and "password" properties will be passed explicitly, so they do not need to be included here. |
Parameter |
Default |
Description |
defaultAutoCommit |
true |
The default auto-commit state of connections created by this pool. |
defaultReadOnly |
driver default |
The default read-only state of connections created by this pool. If not set then the setReadOnly method will not be called. (Some drivers don't support read only mode, ex: Informix) |
defaultTransactionIsolation |
driver default |
The default TransactionIsolation state of connections created by this pool. One of the following: (see javadoc)
- NONE
- READ_COMMITTED
- READ_UNCOMMITTED
- REPEATABLE_READ
- SERIALIZABLE
|
defaultCatalog |
|
The default catalog of connections created by this pool. |
Parameter |
Default |
Description |
initialSize |
0 |
The initial number of connections that are created when the pool is started.
Since: 1.2 |
maxActive |
8 |
The maximum number of active connections that can be allocated from this pool at the same time, or zero for no limit. |
maxIdle |
8 |
The maximum number of active connections that can remain idle in the pool, without extra ones being released, or zero for no limit. |
minIdle |
0 |
The minimum number of active connections that can remain idle in the pool, without extra ones being created, or zero to create none. |
maxWait |
indefinitely |
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. |
Parameter |
Default |
Description |
validationQuery |
|
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. |
testOnBorrow |
true |
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.
NOTE - for a true value to have any effect, the validationQuery parameter must be set to a non-null string. |
testOnReturn |
false |
The indication of whether objects will be validated before being returned to the pool.
NOTE - for a true value to have any effect, the validationQuery parameter must be set to a non-null string. |
testWhileIdle |
false |
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.
NOTE - for a true value to have any effect, the validationQuery parameter must be set to a non-null string. |
timeBetweenEvictionRunsMillis |
-1 |
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. |
numTestsPerEvictionRun |
3 |
The number of objects to examine during each run of the idle object evictor thread (if any). |
minEvictableIdleTimeMillis |
1000 * 60 * 30 |
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). |
Parameter |
Default |
Description |
poolPreparedStatements |
false |
Enable prepared statement pooling for this pool. |
maxOpenPreparedStatements |
unlimited |
The maximum number of open statements that can be allocated from the statement pool at the same time, or zero for no limit. |
This component has also the ability to pool PreparedStatements. When enabled a statement pool will be created for each Connection and PreparedStatements created by one of the following methods will be pooled:
- public PreparedStatement prepareStatement(String sql)
- public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency)
NOTE - Make sure your connection has some resources left for the other statements.
Parameter |
Default |
Description |
accessToUnderlyingConnectionAllowed |
false |
Controls if the PoolGuard allows access to the underlying connection. |
When allowed you can access the underlying connection using the following construct:
Connection conn = ds.getConnection();
Connection dconn = ((DelegatingConnection) conn).getInnermostDelegate();
...
conn.close()
Default is false, it is a potential dangerous operation and misbehaving programs can do harmfull things. (closing the underlying or continue using it when the guarded connection is already closed) Be carefull and only use when you need direct access to driver specific extentions.
NOTE: Do not close the underlying connection, only the original one.
Parameter |
Default |
Description |
removeAbandoned |
false |
Flag to remove abandoned connections if they exceed the removeAbandonedTimout.
If set to true a connection is considered abandoned and eligible for removal if it has been idle longer than the removeAbandonedTimeout. Setting this to true can recover db connections from poorly written applications which fail to close a connection. |
removeAbandonedTimeout |
300 |
Timeout in seconds before an abandoned connection can be removed. |
logAbandoned |
false |
Flag to log stack traces for application code which abandoned a Statement or Connection.
Logging of abandoned Statements and Connections adds overhead for every Connection open or new Statement because a stack trace has to be generated. |
If you have enabled "removeAbandoned" then it is possible that a connection is reclaimed by the pool because it is considered to be abandoned. This mechanism is triggered when (getNumIdle() < 2) and (getNumActive() > getMaxActive() - 3)
For example maxActive=20 and 18 active connections and 1 idle connection would trigger the "removeAbandoned". But only the active connections that aren't used for more then "removeAbandonedTimeout" seconds are removed, default (300 sec). Traversing a resultset doesn't count as being used.
posted on 2006-05-18 14:04
飞鸟 阅读(502)
评论(0) 编辑 收藏 所属分类:
Struts