You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jonny Pony <jo...@hotmail.com> on 2004/11/25 17:40:17 UTC

Hibernate + c3p0

Hi,

there was a post/thread similar to this one lately, argueing about which 
connection pool to use.
But my question is:
How can I use the c3p0-connection pooling in cocoon? I wanna fart around 
with it a little.

My hibernate.properties:
hibernate.connection.driver_class=com.mysql.jdbc.Driver
hibernate.connection.url=jdbc:mysql:xxx
hibernate.connection.username=xxx
hibernate.connection.password=xxx
hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect

This works so far. But if I want to use the c3p0-pool and add the 
c3p0-properties cocoon throws a billion errors on startup. The c3p0 classes 
are found, but some Null pointer exception occours.

My hibernate.properties with c3p0:
hibernate.connection.driver_class=com.mysql.jdbc.Driver
hibernate.connection.url=jdbc:mysql:xxx
hibernate.connection.username=xxx
hibernate.connection.password=xxx
hibernate.c3p0.min_size=5
hibernate.c3p0.max_size=20
hibernate.c3p0.timeout=1800
hibernate.c3p0.max_statements=50
hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect

Do I have to configure something else to get c3p0 working with Cocoon.

cheers
jonny

_________________________________________________________________
Ungestört surfen. MSN Toolbar mit Pop-up-Blocker. http://toolbar.msn.de/ 
Jetzt kostenlos downloaden!


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Hibernate + c3p0

Posted by Leszek Gawron <lg...@mobilebox.pl>.
Jonny Pony wrote:
> Hi,
> 
> there was a post/thread similar to this one lately, argueing about which 
> connection pool to use.
> But my question is:
> How can I use the c3p0-connection pooling in cocoon? I wanna fart around 
> with it a little.
> 
> My hibernate.properties:
> hibernate.connection.driver_class=com.mysql.jdbc.Driver
> hibernate.connection.url=jdbc:mysql:xxx
> hibernate.connection.username=xxx
> hibernate.connection.password=xxx
> hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect
> 
> This works so far. But if I want to use the c3p0-pool and add the 
> c3p0-properties cocoon throws a billion errors on startup. The c3p0 
> classes are found, but some Null pointer exception occours.
> 
> My hibernate.properties with c3p0:
> hibernate.connection.driver_class=com.mysql.jdbc.Driver
> hibernate.connection.url=jdbc:mysql:xxx
> hibernate.connection.username=xxx
> hibernate.connection.password=xxx
> hibernate.c3p0.min_size=5
> hibernate.c3p0.max_size=20
> hibernate.c3p0.timeout=1800
> hibernate.c3p0.max_statements=50
> hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect
> 
> Do I have to configure something else to get c3p0 working with Cocoon.
This is not a cocoon question really :). Do you have c3p0 working with 
hibernate in standalone application? I suggest you start from there. 
Have you tried setting connection provider explicitly?

This is my sample config file which works:
  > <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate 
Configuration DTD 2.0//EN"
> 	"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
> <hibernate-configuration>
> 	<session-factory>
> 		<property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
> 		<property name="dialect">net.sf.hibernate.dialect.SQLServerDialect</property>
> 		
> 		<property name="show_sql">@hibernate.showsql@</property>
> 		<property name="jdbc.batch_size">0</property>
> 		<property name="jdbc.use_streams_for_binary">true</property>
> 		<property name="max_fetch_depth">2</property>
> 		<property name="cache.provider_class">net.sf.ehcache.hibernate.Provider</property>
> 		
> 		<property name="connection.driver_class">com.microsoft.jdbc.sqlserver.SQLServerDriver</property>
> 		<property name="connection.url">@db.url@</property>
> 		<property name="connection.username">@db.username@</property>
> 		<property name="connection.password">@db.password@</property>
> 		
> 		<property name="c3p0.max_size">15</property>
> 		<property name="c3p0.min_size">1</property>
> 		<property name="c3p0.timeout">5000</property>
> 		<property name="c3p0.max_statements">100</property>
> 		<property name="c3p0.idle_test_period">3000</property>
> 		<property name="c3p0.acquire_increment">2</property>
>      		<property name="connection.provider_class">net.sf.hibernate.connection.C3P0ConnectionProvider</property>
> 
> 		<mapping resource="com/mobilebox/gemini/standalone/model/User.hbm.xml"/>
> 	</session-factory>
> </hibernate-configuration>


You can also post to forum.hibernate.org. You should attach your 
stacktrace as the description you gave does not explain much.

-- 
Leszek Gawron                                      lgawron@mobilebox.pl
Project Manager                                    MobileBox sp. z o.o.
+48 (61) 855 06 67                              http://www.mobilebox.pl
mobile: +48 (501) 720 812                       fax: +48 (61) 853 29 65

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org