hibernate链接数据库链接池c3p0配置
简介:
<div class="dp-highlighter bg_html" style="font-family:Consolas,'Courier New',Courier,mono,serif; width:700.909px; overflow:auto; padding-top:1px; color:rgb(51,51,51); line-height:26px; margin:18p
- <bean id="dataSourceLocal" name="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
-
- <property name="driverClass" value="${jdbc.driverClassName}"/>
-
- <property name="jdbcUrl" value="${jdbc.url}"/>
-
- <property name="user" value="${jdbc.username}"/>
-
- <property name="password" value="${jdbc.password}"/>
-
- <property name="maxPoolSize" value="${jdbc.maxPoolSize}"/>
-
- <property name="minPoolSize" value="${jdbc.minPoolSize}"/>
-
- <property name="initialPoolSize" value="${jdbc.initialPoolSize}"/>
-
- <property name="maxIdleTime" value="${jdbc.maxIdleTime}"/>
-
- <property name="acquireIncrement" value="${jdbc.acquireIncrement}"/>
- <!-- JDBC的标准,用以控制数据源内加载的PreparedStatements数量。
- 但由于预缓存的statements属于单个connection而不是整个连接池所以设置这个参数需要考虑到多方面的因数.如果maxStatements与maxStatementsPerConnection均为0,则缓存被关闭。Default:0-->
- <property name="maxStatements" value="${jdbc.maxStatements}"/>
-
- <property name="idleConnectionTestPeriod" value="${jdbc.idleConnectionTestPeriod}"/>
- </bean>
- jdbc.initialPoolSize=20
- jdbc.maxPoolSize=100
- jdbc.minPoolSize=10
- jdbc.maxIdleTime=600
- jdbc.acquireIncrement=5
- jdbc.maxStatements=5
- jdbc.idleConnectionTestPeriod=60