網上沒有找到比較合適的,自己看了看,然后放到項目中實驗的一下。
很多人都認為比DBCP優秀。
<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
連接池初始化時獲取的鏈接數,介于minPoolSize和maxPoolSize之間
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.
最大空閑的時間,單位是秒,無用的鏈接再過時后會被回收
大盤預測
國富論
posted on 2008-01-18 19:47
華夢行 閱讀(240)
評論(0) 編輯 收藏 所屬分類:
Spring