-->
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.  [ 6 posts ] 
Author Message
 Post subject: Troubling enabling c3p0
PostPosted: Tue Sep 26, 2006 1:40 am 
Newbie

Joined: Tue Sep 26, 2006 1:27 am
Posts: 10
I am trying to enable c3p0 (with MySQL) using hibernate.cfg.xml. However it doesn't
appear to be working in that my database connection always dies overnight. Two questions:
1) Is there any simple way to determine if I am actually using c3p0 at all? I've tried
grepping for "c3p0" in tomcat/logs, but that returns no matches.
2) Am I missing anything in my (anonymised) hibernate.cfg.xml, shown below?

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- configuration pool via c3p0-->
<property name="connection.provider_class">
org.hibernate.connection.C3P0ConnectionProvider
</property>
<property name="hibernate.c3p0.acquire_increment">1</property>
<property name="hibernate.c3p0.idle_test_period">100</property> <!-- seconds -->
<property name="hibernate.c3p0.max_size">100</property>
<property name="hibernate.c3p0.max_statements">0</property>
<property name="hibernate.c3p0.min_size">10</property>
<property name="hibernate.c3p0.timeout">100</property>

<property name="connection.url">jdbc:mysql://localhost:3306/???</property>
<property name="connection.username">???</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="connection.password">????????</property>
<property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>

<!-- thread is the short name for
org.hibernate.context.ThreadLocalSessionContext
and let Hibernate bind the session automatically to the thread
-->
<property name="current_session_context_class">thread</property>

<!-- this will show us all sql statements -->
<property name="hibernate.show_sql">true</property>
<property name="hbm2ddl.auto">update</property>

<!-- mapping files -->
<!-- <mapping resource="/Mappings.hbm.xml" /> -->
<mapping resource="org/??????????????????/registry/hibernate/Mappings.hbm.xml"/>

</session-factory>
</hibernate-configuration>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 26, 2006 4:38 am 
Newbie

Joined: Tue Sep 26, 2006 1:27 am
Posts: 10
I should have noted that I am using Hibernate 3.1.3.
I have just upgraded to c3p0 0.9.1pre9 and I have
removed hbm2ddl.auto from my .cfg file.

There is still no message from c3p0 in any of my tomcat logs.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 26, 2006 4:53 am 
Newbie

Joined: Tue Sep 26, 2006 1:27 am
Posts: 10
Ok, I found a big bug resulting in my actually reading an old version of the .cfg file. So now I
know that I am definitely reading the c3p0 version of .cfg.xml but how can I see if c3p0
is actually active? There is still nothing in the logs and I don't want to have to wait until tomorrow to see if my connection has died.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 26, 2006 5:34 am 
Newbie

Joined: Sat Mar 04, 2006 10:07 am
Posts: 9
Try setting hibernate and c3p0 to log level debug in your log4j.properties file if your are using one. Otherwise it would be a good idea to use one.

_________________
Epllcr


Last edited by epllcr on Tue Sep 26, 2006 5:36 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 26, 2006 5:35 am 
Newbie

Joined: Sat Mar 04, 2006 10:07 am
Posts: 9
Try setting hibernate and c3p0 to log level debug in your log4j.properties file if your are using one. Otherwise it would be a good idea to use one.

_________________
Epllcr


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 27, 2006 5:13 am 
Newbie

Joined: Tue Sep 26, 2006 1:27 am
Posts: 10
Ok, everything seems to be working now, and I can even see that it's working. Thanks.


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