-->
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.  [ 5 posts ] 
Author Message
 Post subject: c3p0 not closing connections on SesisonFactory close()
PostPosted: Sat Nov 01, 2003 3:13 pm 
Regular
Regular

Joined: Sun Sep 21, 2003 11:43 pm
Posts: 85
Location: Massachusetts
I'm running a servlet on Tomcat 4.1.24 for Hibernate 2.0.3. I use C3P0 in my hibernate.cfg.xml files. When I try to close the factory using my SessionFactory's close() call, the C3P0 pool is being orphaned, not shut down. This is eating up my memory and leaving database connections open. Does anyone have any suggestions?

My hibernate.cfg.xml file is this:

<hibernate-configuration>
<!-- a SessionFactory instance listed as /jndi/name -->
<session-factory>
<!-- properties -->
<!-- property name="connection.datasource">my/first/datasource</property> -->
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<property name="connection.username">someDBUser</property>
<property name="connection.password">someDBPAss</property>
<property name="connection.url">jdbc:mysql://localhost:3306/someDB?autoReconnect=true</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="show_sql">false</property>
<property name="use_outer_join">true</property>
<property name="transaction.factory_class">net.sf.hibernate.transaction.JDBCTransactionFactory</property>
<property name="c3p0.max_size">20</property>
<property name="c3p0.min_size">2</property>
<property name="c3p0.timeout">3600</property>
<property name="c3p0.max_statements">100</property>
<property name="c3p0.valudate">false</property>

<!-- mapping files -->
<mapping resource="Misc.hbm.xml"/>
</session-factory>
</hibernate-configuration>

Thanks for any suggestions.

Regards,
David


Top
 Profile  
 
 Post subject: Sorry.. Wrong forum, please delete this thread
PostPosted: Sat Nov 01, 2003 3:44 pm 
Regular
Regular

Joined: Sun Sep 21, 2003 11:43 pm
Posts: 85
Location: Massachusetts
I must've mis-clicked as I thought I was posting to the beginners forum since a form 'search' turned up nothing useful.

Regards,
David


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 04, 2003 6:11 pm 
Regular
Regular

Joined: Fri Sep 05, 2003 12:01 am
Posts: 80
Location: Bogot
use dbcp instead of c3p0.

Or even better, if you are running in a container like JBoss use datasources managed by the container.

_________________
Mauricio Hern


Top
 Profile  
 
 Post subject: I already switched.
PostPosted: Tue Nov 04, 2003 6:22 pm 
Regular
Regular

Joined: Sun Sep 21, 2003 11:43 pm
Posts: 85
Location: Massachusetts
I'd emailed Steve Waldman about his C3P0 project and got this response about the 0.8.3 C3P0 passed out with Hibernate 2.0.2 & 2.0.3:

---------------
You'll have to upgrade to the latest 0.8.4 test release, but if you do,
you can force DataSources to clean themselves up by calling the static
method DataSources.destroy(DataSource pooledDataSource ), or
equivalently by casting the DataSource to a
com.mchange.v2.c3p0.PooledDataSource and calling its close() method.
---------------

Regardless, yesterday I commented out my C3P0 settings and added
<property name="dbcp.minIdle">1</property>
to my hibernate.cfg.xml files. It got rid of most of my emory problems since C3P0 was eating up memory. I think I still have a leak somewhere but I haven't found it yet (though I'm sure I've freed everything up).

Regards,
David


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 04, 2003 8:01 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
cool, I'll support this new feature when 0.8.4 final is released.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.