开发者

Jboss Connection pooling or Hibernate Connection pooling

We use Spring + Hibernate in Jboss application server. We have been using Jboss connection pooling for all our application connection pooling needs using the *-ds.xml file as follows

<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>

Recently we are seeing recurring "Connection reset" and "No Managed connections" exceptions. We use Spring's transactions management so we manually do not close any connection. Is it necessary to close the connections manually or should we abandon the Jboss Connection pooling and use c3po connection pooling mechanism or can we use both of them together.

Our hibernate properties in Sessionfactory ...

<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_bi开发者_如何学编程nary">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>


I'm not familiar with "JBoss connection pool", but it sounds like you have connections that are timing out or being cut by a firewall while they're in the pool. Most connection pools let you set a "validation query" that will be run before a connection is handed out to verify the connection is still alive. Using that will make the pool discard dead connections before they can be given to your application for use.

Update: Maybe you're looking for <check-valid-connection-sql>?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜