c3p0 & proxool--风间小筑

J2EE

c3p0 & proxool
风间残月 发表于 2005-7-5 9:55:00

前一段时间用c3p0作hibernate3的连接池,发现连接数总是很多,并不能释放,用几天就会占用100多个数据库连接,尝试修改了几次配置文件问题依旧,无奈换成了proxool,问题居然解决了。

  c3p0配置

  <property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
  <property name="hibernate.c3p0.max_size">20</property>
  <property name="hibernate.c3p0.min_size">5</property>
  <property name="hibernate.c3p0.timeout">120</property>
  <property name="hibernate.c3p0.max_statements">100</property>
  <property name="hibernate.c3p0.idle_test_period">120</property>
  <property name="hibernate.c3p0.acquire_increment">2</property>

 proxool配置

  <property name="hibernate.connection.provider_class">org.hibernate.connection.ProxoolConnectionProvider</property>
  <property name="hibernate.proxool.pool_alias">xjgame</property>
  <property name="hibernate.proxool.xml">proxool.xml</property>

 

 <?xml version="1.0" encoding="ISO-8859-1"?>
 <something-else-entirely>
  <proxool>
    <alias>xjgame</alias>
    <driver-url>jdbc:oracle:thin:@123.123.123.12:1521:game</driver-url>
    <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
    <driver-properties>
      <property name="user" value="a"/>
      <property name="password" value="a"/>
    </driver-properties>
    <maximum-connection-count>20</maximum-connection-count>
    <house-keeping-test-sql>select CURRENT_DATE from dual</house-keeping-test-sql>
  </proxool>
</something-else-entirely>