Jboss连接池或休眠连接池
问题描述:
我们在Jboss应用服务器中使用Spring + Hibernate。我们一直在使用使用* -ds.xml文件的Jboss连接池为我们所有的应用程序连接池的需求如下Jboss连接池或休眠连接池
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>dev_1</user-name>
<password>*********</password>
<min-pool-size>5</min-pool-size>
<max-pool-size>15</max-pool-size> // production system has more than 80 connections
<idle-timeout-minutes>1</idle-timeout-minutes>
最近,我们看到重复的“连接重置”和“无管理的连接”的异常。 我们使用Spring的事务管理,所以我们手动不关闭任何连接。是否需要手动关闭连接,或者是否应放弃Jboss连接池并使用c3po连接池机制,或者我们可以将它们一起使用。在SessionFactory的
我们的Hibernate属性...
<property name="hibernateProperties">
<props>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle9iDialect</prop>
<prop key="hibernate.jdbc.batch_size">0</prop>
<prop key="hibernate.jdbc.factory_class">net.bull.javamelody.HibernateBatcherFactory</prop>
<prop key="hibernate.use_streams_for_binary">true</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.provider_configuration_file_resource_path">ehcache.xml</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<prop key="hibernate.cache.query_cache_factory">com.cisco.ipcentral.hibernate.cache.StandardQueryCacheFactory</prop>
<!-- applicationContext hibernateProperties merge-point -->
</props>
</property>
答
我不熟悉的“JBoss的连接池”,但它听起来像是你有超时时,或当他们防火墙被切断连接在游泳池里。大多数连接池允许您设置一个“验证查询”,该连接在分发连接之前运行,以验证连接是否仍然存在。使用它可以使池在放弃应用程序之前丢弃死连接。
更新:也许您在寻找<check-valid-connection-sql>
?