c3p0连接池的使用

<bean id="c3p0DataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
      <property name="driverClass">
        <value>${jdbc.driverClassName}</value>
      </property>
      <property name="jdbcUrl">
        <value>${jdbc.url}</value>
      </property>
      <property name="user">
       <value>${jdbc.username}</value>
      </property>
      <property name="password">
       <value>${jdbc.password}</value>
      </property>
      <property name="initialPoolSize"><value>10</value></property>
      <property name="minPoolSize"><value>5</value></property>
      <property name="maxPoolSize"><value>30</value></property>
      <property name="acquireIncrement"><value>5</value></property>
      <property name="maxIdleTime"><value>10</value></property>
      <property name="maxStatements"><value>0</value></property>
    </bean>

以下几个参数是使用的基本配置参数:
initialPoolSize

Number of Connections a pool will try to acquire upon startup. Should be between minPoolSize and maxPoolSize
连接池初始化时获取的链接数,介于minPoolSizemaxPoolSize之间

minPoolSize

Minimum number of Connections a pool will maintain at any given time.
最小链接数

maxPoolSize

Maximum number of Connections a pool will maintain at any given time.
最大连接数

acquireIncrement

Determines how many connections at a time c3p0 will try to acquire when the pool is exhausted.
在当前连接数耗尽的时候,一次获取的新的连接数

maxIdleTime

Seconds a Connection can remain pooled but unused before being discarded. Zero means idle connections never expire.
最大空闲的时间,单位是秒,无用的链接再过时后会被回收

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值