java c3p0标准配置实例

<?xml version="1.0" encoding="UTF-8"?>  
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd      http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">  
      
<bean id="dataSource5" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">  
    <property name="driverClass" value="com.mysql.jdbc.Driver"/>  
    <property name="jdbcUrl" value="jdbc:mysql://192.168.1.213:3306/test?useUnicode=true&amp;characterEncoding=utf8&amp;zeroDateTimeBehavior=convertToNull"/>  
    <property name="user" value="chinahrt"/>  
    <property name="password" value="123456"/>  
      
        <property name="initialPoolSize" value="5"/>  
    <property name="minPoolSize" value="5"/>  
    <property name="maxPoolSize" value="10"/>   
    <!-- <property name="maxConnectionAge" value="1800"/> -->  
    <property name="maxIdleTime" value="1000"/>  
    <property name="acquireIncrement" value="3"/>  
    <property name="maxStatements" value="0"/>  
    <property name="idleConnectionTestPeriod" value="1000"/>  
    <!-- <property name="acquireRetryAttempts" value="30"/> -->  
    <!-- <property name="breakAfterAcquireFailure" value="true"/> --> 

    <!-- handle connection breaks after timeout -->
    <property name="testConnectionOnCheckout" value="true"/>
    <!-- 对于hibernate3.x,建议使用preferredTestQuery来代替 -->
    <!-- <propertyname="hibernate.c3p0.preferredTestQuery"value="select 1;"/> -->
    
    <!-- <property name="unreturnedConnectionTimeout" value="3500"/> -->  
    <!-- <property name="debugUnreturnedConnectionStackTraces" value="true"/> -->  
    </bean>  
      
</beans> 

猜你喜欢

转载自qify.iteye.com/blog/1888880