proxool连接池配制
<something-else-entirely> <proxool-config> <proxool> <alias>DBPool</alias> <driver-url> jdbc:mysql://localhost:3306/cdjyxy</driver-url> <driver-class>com.mysql.jdbc.Driver</driver-class> <driver-properties> <property name="user" value="root" /> <property name="password" value="1" /> <!-- 设置自动重连 --> <property name="autoReconnect" value="true" /> </driver-properties> <house-keeping-sleep-time>90000</house-keeping-sleep-time> <maximum-new-connections>20</maximum-new-connections> <prototype-count>3</prototype-count> <test-before-use>true</test-before-use> <test-after-use>true</test-after-use><!--用于测试的SQL语句--> <house-keeping-test-sql>SELECT CURRENT_USER</house-keeping-test-sql> <maximum-connection-count>100</maximum-connection-count> <minimum-connection-count>10</minimum-connection-count> </proxool> </proxool-config> </something-else-entirely>
hibernate.cfg.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">
<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">
org.hibernate.connection.ProxoolConnectionProvider
</property>
<property name="hibernate.proxool.pool_alias">DBPool</property>
<property name="hibernate.proxool.xml">proxool.xml</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<mapping resource="com/test/hibernate/Userlinker.hbm.xml"/>
<mapping resource="com/test/hibernate/Users.hbm.xml"/>
<mapping resource="com/test/hibernate/Files.hbm.xml"/>
</session-factory>
</hibernate-configuration>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">
org.hibernate.connection.ProxoolConnectionProvider
</property>
<property name="hibernate.proxool.pool_alias">DBPool</property>
<property name="hibernate.proxool.xml">proxool.xml</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<mapping resource="com/test/hibernate/Userlinker.hbm.xml"/>
<mapping resource="com/test/hibernate/Users.hbm.xml"/>
<mapping resource="com/test/hibernate/Files.hbm.xml"/>
</session-factory>
</hibernate-configuration>
然后在WEB-INF/lib下加入两jar包proxool-0.9.1.jar,proxool-cglib.jar
这样就可以了