Hibernate Proxool连接池配置总结及常遇问题

http://hi.baidu.com/itanyang/blog/item/7a59b2d0b3ec9b8aa1ec9c17.html

Hibernate.hbm.xml文件配置

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory name="default">
    <property name="dialect">
    org.hibernate.dialect.MySQLDialect
   </property>
   <property name="show_sql">true</property>
   <property name="show_format">true</property>
   <property name="myeclipse.connection.profile">shsmis</property>
   <!-- proxool connection pools-->
  <property name="hibernate.proxool.pool_alias">pool</property>
   <property name="hibernate.proxool.xml">ProxoolConf.xml</property>
   <property name="connection.provider_class">
    org.hibernate.connection.ProxoolConnectionProvider
   </property>
   <mapping resource="org/shsmis/hibernate/vo/Manager.hbm.xml" />
</session-factory>
</hibernate-configuration>

ProxoolConf.xml文件配置

<?xml version="1.0" encoding="UTF-8"?>
<proxool>
<alias>pool</alias>
<driver-url>jdbc:mysql://localhost:3306/shsmis</driver-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<driver-properties>
<property name="user" value="root"></property>
<property name="password" value="root"></property>
</driver-properties>
<house-keeping-sleep-time>90000</house-keeping-sleep-time>
<maximum-new-connections>20</maximum-new-connections>
<prototype-count>5</prototype-count>
<maximum-connection-count>100</maximum-connection-count>
<minimum-connection-count>10</minimum-connection-count>
</proxool>

相关推荐