網(wǎng)上沒有找到比較合適的,自己看了看,然后放到項(xiàng)目中實(shí)驗(yàn)的一下。
很多人都認(rèn)為比DBCP優(yōu)秀。
<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>
以下幾個參數(shù)是使用的基本配置參數(shù):
initialPoolSize:
Number of Connections a pool will try to acquire upon startup. Should be between minPoolSize and maxPoolSize
連接池初始化時獲取的鏈接數(shù),介于minPoolSize和maxPoolSize之間
minPoolSize:
Minimum number of Connections a pool will maintain at any given time.
最小鏈接數(shù)
maxPoolSize:
Maximum number of Connections a pool will maintain at any given time.
最大連接數(shù)
acquireIncrement:
Determines how many connections at a time c3p0 will try to acquire when the pool is exhausted.
在當(dāng)前連接數(shù)耗盡的時候,一次獲取的新的連接數(shù)
maxIdleTime:
Seconds a Connection can remain pooled but unused before being discarded. Zero means idle connections never expire.
最大空閑的時間,單位是秒,無用的鏈接再過時后會被回收
posted on 2007-05-25 16:29
SIMONE 閱讀(3179)
評論(0) 編輯 收藏 所屬分類:
JAVA 、
JSP