removeAbandoned参数,用来检测到当前使用的连接是否发生了连接泄露,所以在代码内部就假定如果一个连接建立连接的时间很长,则将其认定为泄露,继而强制将其关闭掉。
DBCP
c3p0
Druid
是否超时关闭连接
removeAbandoned
breakAfterAcquireFailure
removeAbandoned
超时时间
removeAbandonedTimeout
checkoutTimeout
removeAbandonedTimeout
是否记录日志
logAbandoned
logAbandoned
c3p0重连设置:
设置获取连接失败后,是否重新连接以及间隔时间。
DBCP
c3p0
Druid
重连次数
acquireRetryAttempts
间隔时间
acquireRetryDelay
4. 配置详解 4.1 DBCP 属性说明表
属性(Parameter)
默认值(Default)
描述(Description)
username
传递给JDBC驱动的用于建立连接的用户名(The connection username to be passed to our JDBC driver to establish a connection.)
password
传递给JDBC驱动的用于建立连接的密码(The connection password to be passed to our JDBC driver to establish a connection.)
url
传递给JDBC驱动的用于建立连接的URL(The connection URL to be passed to our JDBC driver to establish a connection.)
driverClassName
使用的JDBC驱动的完整有效的java 类名(The fully qualified Java class name of the JDBC driver to be used.)
defaultAutoCommit
driver default
连接池创建的连接的默认的auto-commit状态,没有设置则不会自动提交(The default auto-commit state of connections created by this pool. If not set then the setAutoCommit method will not be called.)
initialSize
0
初始化连接:连接池启动时创建的初始化连接数量(The initial number of connections that are created when the pool is started.
maxTotal
8
最大活动连接:连接池在同一时间能够分配的最大活动连接的数量, 如果设置为非正数则表示不限制(The maximum number of active connections that can be allocated from this pool at the same time, or negative for no limit.)
maxIdle
8