-->
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: cannot use c3p0 with hibernate 3.3.0 GA
PostPosted: Sat Aug 16, 2008 5:06 am 
Newbie

Joined: Fri Apr 06, 2007 1:54 am
Posts: 14
Hibernate version:
3.3.0 GA

Debug level Hibernate log excerpt:
2008-08-16 12:00:34,499 DEBUG (Configuration.java:1281) - resolving reference to class: foo.bar.Customer
2008-08-16 12:00:34,499 DEBUG (Configuration.java:1281) - resolving reference to class: foo.bar.Order
2008-08-16 12:00:34,608 INFO (DriverManagerConnectionProvider.java:64) - Using Hibernate built-in connection pool (not for production use!)
2008-08-16 12:00:34,608 INFO (DriverManagerConnectionProvider.java:65) - Hibernate connection pool size: 20
2008-08-16 12:00:34,608 INFO (DriverManagerConnectionProvider.java:68) - autocommit mode: false
2008-08-16 12:00:34,624 INFO (DriverManagerConnectionProvider.java:103) - using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/foobar?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true
2008-08-16 12:00:34,624 INFO (DriverManagerConnectionProvider.java:106) - connection properties: {user=foobar, password=foobar}
2008-08-16 12:00:34,624 DEBUG (DriverManagerConnectionProvider.java:132) - opening new JDBC connection
2008-08-16 12:00:35,108 DEBUG (DriverManagerConnectionProvider.java:138) - created connection to: jdbc:mysql://localhost:3306/foobar?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true, Isolation Level: 4
2008-08-16 12:00:35,108 INFO (SettingsFactory.java:116) - RDBMS: MySQL, version: 5.0.51a-community-nt
2008-08-16 12:00:35,108 INFO (SettingsFactory.java:117) - JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.0.8 ( Revision: ${svn.Revision} )

hibernate.cfg.xml
Code:
    <property name="hibernate.c3p0.acquire_increment">1</property>
    <property name="hibernate.c3p0.idle_test_period">60</property>
    <property name="hibernate.c3p0.min_size">1</property>
    <property name="hibernate.c3p0.max_size">5</property>
    <property name="hibernate.c3p0.max_statements">50</property>
    <property name="hibernate.c3p0.timeout">0</property>
    <property name="hibernate.c3p0.acquireRetryAttempts">2</property>
    <property name="hibernate.c3p0.acquireRetryDelay">2</property>


I switched to hibernate 3.3.0 GA, didn't change anything in my hibernate.cfg.xml, but now the log tells me "Using Hibernate built-in connection pool (not for production use!)"
c3p0-0.9.1.jar is included in the project dependencies.

Am I doing something wrong?

thanks


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 17, 2008 3:48 pm 
Regular
Regular

Joined: Fri Dec 17, 2004 10:38 am
Posts: 54
include hibernate-c3p0.jar into your classpath (included in 3.3.0 distribution)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 18, 2008 2:32 am 
Newbie

Joined: Fri Apr 06, 2007 1:54 am
Posts: 14
Thanks for your reply.

I can't find this jar inside hibernate-distribution-3.3.0.GA-dist.zip
It only has c3p0-0.9.1.jar which is already in my classpath.

I'll try again.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 18, 2008 2:53 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
I can't find the file hibernate-c3p0.jar either, but I don't have any problem with C3P0. It could be that my hibernate.cfg.xml is a bit different:

Code:
<property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
<property name="c3p0.min_size">1</property>
<property name="c3p0.max_size">20</property>
<property name="c3p0.timeout">3600</property>
.... etc


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 18, 2008 3:53 am 
Newbie

Joined: Fri Apr 06, 2007 1:54 am
Posts: 14
Thanks a lot! That solved it.

Code:
2008-08-18 10:48:30,164 INFO  (ConnectionProviderFactory.java:95) - Initializing connection provider: org.hibernate.connection.C3P0ConnectionProvider
2008-08-18 10:48:30,179 INFO  (C3P0ConnectionProvider.java:103) - C3P0 using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://...


The weird thing is that I've been using hibernate in production for 1.5 years now and never had to use that configuration option.

I wasn't aware of this option since http://www.hibernate.org/214.html and http://www.mchange.com/projects/c3p0/in ... e-specific do not mention it.

thanks again


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.