Spring+Hibernate配置proxool数据连接池[转]


 springhibernate配置proxoomysql  
<bean id="DataSource"
  class="org.logicalcobwebs.proxool.ProxoolDataSource">
  <property name="driver">
   <value>org.gjt.mm.mysql.Driver</value>
  </property>
  <property name="driverUrl">
   <value>jdbc:mysql://localhost:3306/ordermanagement?user=root&amp;password=123</value>
  </property>
  <property name="user">
   <value>root</value>
  </property>
  <property name="password">
   <value>123</value>
  </property>
  <!-- 最大连接数(默认20个)-->
  <property name="maximumConnectionCount">
   <value>20</value>
  </property>
  <!-- 最小连接数(默认5个) -->
  <property name="minimumConnectionCount">
   <value>5</value>
  </property>
  <!-- alias 属性可以覆盖默认的别名 -->
  <property name="alias">
   <value>autumn</value>
  </property>
  <!-- trace为true,记录数据库每一步操作 -->
  <property name="trace">
   <value>true</value>
  </property>
  <!-- proxool自动侦察各个连接状态的时间间隔(毫秒),侦察到空闲的连接就马上回
           收,超时的销毁 (默认30秒)-->
  <!--<property name="houseKeepingSleepTime">
   <value>90000</value>
  </property>
  --><!-- 最少保持的空闲连接数 (默认5个)-->
  <property name="prototypeCount">
   <value>5</value>
  </property>
  <!--verbose:If this is true then we start logging a lot of stuff everytime we serve a connection and everytime the house keeper and prototyper run. Be prepared for a lot of debug!  -->
  <property name="verbose">
   <value>true</value>
  </property>
 </bean>


 <bean id="sessionFactory"
  class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
  <property name="dataSource">
   <ref bean="DataSource" />
  </property>
  <property name="hibernateProperties">
   <props>
    <prop key="hibernate.dialect">
     org.hibernate.dialect.MySQLDialect
    </prop>
    <prop key="hibernate.show_sql">true</prop>
    <prop key="hibernate.connection.useUnicode">true</prop>
    <prop key="hibernate.connection.characterEncoding">gbk</prop>
    <prop key="hibernate.connection.release_mode">auto</prop>
    <prop key="hibernate.cglib.use_reflection_optimizer">
        ${hibernate.cglib.use_reflection_optimizer}
       </prop>
       <prop key="hibernate.connection.provider_class">
        ${hibernate.connection.proxool_provider_class}
       </prop>
       <prop key="hibernate.proxool.pool_alias">
        ${hibernate.proxool.pool_alias}
       </prop>
       <prop key="hibernate.proxool.xml">
        ${hibernate.proxool.xml}
       </prop>
    
   </props>
  </property>
  <property name="mappingResources">
   <list>
    <value>com/autumn/vo/Film.hbm.xml</value>
    <value>com/autumn/vo/Manager.hbm.xml</value>
    <value>com/autumn/vo/Orders.hbm.xml</value>
    <value>com/autumn/vo/User.hbm.xml</value>
   </list>
  </property>
 </bean>


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