-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Hibernate eats connection pool + FIX
PostPosted: Thu Mar 30, 2006 10:07 am 
Newbie

Joined: Tue Oct 04, 2005 1:20 pm
Posts: 16
Location: The Netherlands
Dear list,

I'd like to share my fix with you after being stuck with this problem for 2 days...

Table 3.4 of the Hibernate v3 reference doc states that the property hibernate.connection.release_mode is set to on_close by default. However, while inspecting the Hibernate classes I noticed that this property was set to after_transaction. This setting prevented Hibernate from releasing its SQL connections so that the connection pool couldn't recycle them. After explicitly setting this property to on_close Hibernate released the connections appropriately.

I use Hibernate v3.1 and my Spring applicationContext.xml reads as follows:

Code:
...
   <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
      <property name="mappingResources">
         <list>
            <value>aMapping.hbm.xml</value>
         </list>
      </property>
      <property name="hibernateProperties">
         <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
            <prop key="hibernate.show_sql">false</prop>
            <prop key="hibernate.connection.release_mode">on_close</prop>
         </props>
      </property>
      <property name="dataSource">
         <ref bean="hibernateDataSource" />
      </property>
   </bean>
   <bean id="hibernateDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
      <property name="jndiName" value="java:comp/env/jdbc/happi" />
   </bean>
...


Kind regards,
Bas Cancrinus - www.iprofs.nl


Top
 Profile  
 
 Post subject: Thanks for sharing...
PostPosted: Fri Mar 31, 2006 2:58 am 
Newbie

Joined: Mon Nov 28, 2005 7:25 am
Posts: 3
Hi Bas,

Thanks for sharing this information. I will check up my hibernate apps right away!


Top
 Profile  
 
 Post subject: Tried that with no effect
PostPosted: Tue Dec 18, 2007 11:31 am 
Beginner
Beginner

Joined: Wed May 16, 2007 7:12 am
Posts: 41
Location: London
Tried that with no effect
Then, I tried
Code:
<JDBCConnectionPool
       ConnLeakProfilingEnabled="true"
        ConnProfilingEnabled="true"
        ConnectionReserveTimeoutSeconds="10"
        CountOfTestFailuresTillFlush="1"
        DriverName="oracle.jdbc.OracleDriver"
        MaxCapacity="1500"
        Name="Connection Pool"
        Password="tiger"
        Properties="user=scott"
        StatementCacheSize="0"
        Targets="test-Cluster"
        TestConnectionsOnCreate="true" TestConnectionsOnRelease="true"
        TestConnectionsOnReserve="true"
        TestTableName="SQL SELECT 1 FROM DUAL" URL="jdbc:oracle:thin:@()))"/>   


and ConnectionReserveTimeoutSeconds="10" seemed to help a bit.
I am on weblogic 8.1 sp6. but the connections still keep growing, even though we have just 12 testers.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.