spring 下配置 dbcp,c3p0,proxool 等数据源连接池
程序员文章站
2023-12-26 19:17:31
...
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 配置 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 下配置 dbcp,c3p0,proxool 等数据源连接池
-
spring 下配置 dbcp,c3p0,proxool 等数据源连接池
-
使用dbcp、c3p0以及阿里druid数据源连接池配置参数详解
-
DBCP,CP30,proxool连接池在spring hibernate中的配置
-
DBCP,CP30,proxool连接池在spring hibernate中的配置
-
总结spring下配置dbcp,c3p0,proxool数据源链接池
-
Spring配置数据源的三种方式 (dbcp,c3p0,jndi).
-
bboss 持久层配置apache dbcp,proxool,c3p0,Druid等数据源方法
-
Mysql配置Spring数据源c3p0与dbcp
-
说说在 Spring 中如何使用数据源(DBCP、C3P0、JNDI 等)