-->
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: hibernate.properties connection
PostPosted: Wed Apr 21, 2004 8:11 pm 
Newbie

Joined: Wed Apr 21, 2004 7:57 pm
Posts: 4
In my main properties (hibernate.properties) I use:
### C3P0 Connection Pool ###
hibernate.connection.provider_class net.sf.hibernate.connection.C3P0ConnectionProvider
hibernate.c3p0.max_size 2
hibernate.c3p0.min_size 2
hibernate.c3p0.timeout 5000
hibernate.c3p0.max_statements 100
hibernate.c3p0.idle_test_period 3000
hibernate.c3p0.acquire_increment 2
hibernate.c3p0.validate false
##################

When running I get:
INFO: loaded properties from resource hibernate.properties: {hibernate.c3p0.timeout=5000.......

but then later I get:
INFO: Using Hibernate built-in connection pool (not for production use!)
Apr 21, 2004 4:57:06 PM net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 20

why do I still get this????


This is how i call get properties:

private Properties getProps(String propFileName)
{
Properties props = new Properties();
try {
InputStream instr = this.getClass().getResourceAsStream( propFileName );
if (instr == null) {
System.err.println("Hibernate properties file " + propFileName + " not found");
throw new RuntimeException();
}
props.load(instr);
} catch (java.io.IOException e) {
System.err.println("Hibernate properties file " + propFileName + " is unreadable");
throw new RuntimeException();
}
return props;
}


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 22, 2004 3:54 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Have you used a debugger to check if your properties get correctly loaded and correctly passed to Hibernate?


Top
 Profile  
 
 Post subject: Re: hibernate.properties connection
PostPosted: Tue May 04, 2004 1:04 pm 
Beginner
Beginner

Joined: Thu Apr 15, 2004 5:12 pm
Posts: 21
Cindy Lee wrote:
...


Cindy, did you resolve this issue? I'm seeing the same behavior.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 11, 2004 2:41 pm 
Beginner
Beginner

Joined: Thu May 06, 2004 4:06 pm
Posts: 25
Hello,

Anyone found an answer to this problem? I am also experiencing the same issure.

hibernate.properties:

Code:
hibernate.connection.provider_class=net.sf.hibernate.connection.C3P0ConnectionProvider
hibernate.c3p0.initialPoolSize=0
hibernate.c3p0.minPoolSize=0
hibernate.c3p0.maxPoolSize=25
hibernate.c3p0.timeout=180
hibernate.c3p0.idleConnectionTestPeriod=10
hibernate.c3p0.max_statements=50
hibernate.c3p0.validate=false


Start-Up:

Code:
11:31:50,291  INFO Environment:496 - loaded properties from resource hibernate.properties: {hibernate.c3p0.idleConnectionTestPeriod=10, hibernate.c3p0.timeout=180, hibernate.jdbc.fetch_size=25, hibernate.cglib.use_reflection_optimizer=true, hibernate.c3p0.max_statements=50, hibernate.cache.use_query_cache=true, hibernate.c3p0.validate=false, hibernate.jdbc.use_streams_for_binary=true, hibernate.c3p0.initialPoolSize=0, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.jdbc.batch_size=20, hibernate.c3p0.maxPoolSize=25, hibernate.c3p0.minPoolSize=0, hibernate.jdbc.use_scrollable_resultset=true, hibernate.connection.provider_class=net.sf.hibernate.connection.C3P0ConnectionProvider, hibernate.show_sql=true}


...still using the default:

Code:
11:31:51,332  INFO DriverManagerConnectionProvider:42 - Using Hibernate built-in connection pool (not for production use!)
11:31:51,342  INFO DriverManagerConnectionProvider:43 - Hibernate connection pool size: 20


And yes, the c3p0.jar file is in my classpath.

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 11, 2004 2:49 pm 
Beginner
Beginner

Joined: Thu May 06, 2004 4:06 pm
Posts: 25
The only way i got the c3p0 connection provider to work was to create a new properties object in my code, set the hibernate.connection.provider_class property there!

Code:
Properties hibernateProperties = new Properties();
hibernateProperties.put( "hibernate.connection.provider_class", "net.sf.hibernate.connection.C3P0ConnectionProvider" );


Code:
net.sf.hibernate.cfg.Configuration hibernateConfig = new net.sf.hibernate.cfg.Configuration();
hibernateConfig.setProperties( properties );


Makes me wonder what other properties are not being set?


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 12, 2004 4:09 am 
Newbie

Joined: Fri May 07, 2004 11:17 am
Posts: 3
I think I had the same problem before when I was playing around with the properties file. I'm not sure what solved the problem but I think I added the following line:

hibernate.connection.pool_size 2

It's worth giving a try!

_________________
- Yagiz Erkan -
http://www.erkans.com


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.