spring 下配置 dbcp,c3p0,proxool 等数据源连接池

spring 下如何配置 dbcp,c3p0,proxool 等数据源连接 池。

Spring 配置 dbcp 数据源:
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName"> <value>${jdbc.driverClassName}</value> </property> <property name="url"> <value>${jdbc.url}</value> </property> <property name="username"> <value>${jdbc.username}</value> </property> <property name="password"> <value>${jdbc.password}</value> </property> <property name="maxActive"> <value>80</value> </property> <property name="maxIdle"> <value>20</value> </property> <property name="maxWait"> <value>3000</value> </property> </bean>

Spring 中配置 c3p0 数据源:
<bean id="dataSource" 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="acquireIncrement"> <value>5</value> </property> <property name="idleConnectionTestPeriod"> <value>3000</value> </property> <property name="checkoutTimeout"> <value>3000</value> </property> <property name="maxPoolSize"> <value>80</value> </property> <property name="minPoolSize"> <value>1</value> </property> <property name="maxStatements"> <value>6000</value> </property> <property name="initialPoolSize"> <value>5</value> </property> </bean>

Spring 中配置 proxool 数据源:
<bean id="dataSource" class="org.logicalcobwebs.proxool.ProxoolDataSource" destroy-method="close"> <property name="driver"> <value>${jdbc.driverClassName}</value> </property> <property name="driverUrl"> <value>${jdbc.url}</value> </property> <property name="user"> <value>${jdbc.username}</value> </property> <property name="password"> <value>${jdbc.password}</value> </property> <property name="alias"> <value>test</value> </property> <property name="houseKeepingSleepTime"> <value>90000</value> </property> <property name="prototypeCount"> <value>10</value> </property> <property name="maximumConnectionCount"> <value>100</value> </property> <property name="minimumConnectionCount"> <value>10</value> </property> <property name="trace"> <value>true</value> </property> <property name="verbose"> <value>true</value> </property> </bean>

你可能感兴趣的:(spring,连接池,c3p0,DBCP,proxool)