dbcp在hibernate+spring中的配置

 

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
         <property name="url" value="jdbc:mysql://192.168.0.xx/xx?createDatabaseIfNotExist=true&amp;useUnicode=true&amp;characterEncoding=utf-8&amp;zeroDateTimeBehavior=convertToNull&amp;transformedBitIsBoolean=true"/>
        <property name="username" value="xx"/>
        <property name="password" value="xx"/>
        <property name="maxActive" value="120"/>
        <property name="initialSize" value="50"/>
        <property name="maxIdle" value="100"/>
        <property name="minIdle" value="100"/>
        <property name="maxWait" value="150"/>
        <property name="defaultAutoCommit" value="true"/>
        <property name="removeAbandoned" value="true"/>
        <property name="removeAbandonedTimeout" value="600"/>
        <property name="logAbandoned" value="true"/>
        <property name="validationQuery" value="SELECT 1"/>
        <property name="testOnBorrow" value="true" />
        <property name="testOnReturn" value="false" />
        <property name="testWhileIdle" value="true"/>
        <property name="timeBetweenEvictionRunsMillis" value="600000"/>
        <property name="minEvictableIdleTimeMillis" value="900000"/>
    </bean>

你可能感兴趣的:(spring,Hibernate,bean,mysql,jdbc)