-->
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.  [ 3 posts ] 
Author Message
 Post subject: another question on hibernate/c3p0
PostPosted: Sat Jan 13, 2007 2:26 am 
Newbie

Joined: Wed Jan 10, 2007 5:15 pm
Posts: 7
If I set:
hibernate.c3p0.max_size = 100
hibernate.c3p0.min_size = 50


and leave the default value for "maxPoolSize" which is 15.

does this mean c3p0 will automatically create up to 7 pools if needed?
(i.e. since 15 x 7 = 105 is the lowest multiple of 15 greater than or equal to 100)


I hope so! otherwise I will be really confused since there is no property to specify number of pools to be used.

Also, If I have a SINGLE user that is used to create connections and suppose 5 pools were created so far. Will the getNumUserPools() in ComboPooledDataSource/PoolBackedDataSource method return 1 or 5?
(i would think 5)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 15, 2007 4:09 am 
C3P0 Developer
C3P0 Developer

Joined: Tue Jan 06, 2004 8:58 pm
Posts: 145
wouvlfe,

First, you should check out your c3p0 pool's config dump at initialization, to see what parameter values c3p0 is actually seeing. I'm not sure how you are instantiating and configuring the DataSource that matters to you, whether hibernate is doing it with its internal provider, or Spring is creating a ComboPooledDataSource for you. The difference is important. hibernate.c3p0.max_size and hibernate.c3p0.min_size only have meaning if hibernate's C3P0ConnectionProvider is creating and configuring the DataSource.

hibernate.c3p0.min_size is equivalent to c3p0.minPoolSize.
hibernate.c3p0.max_size is equivalent to c3p0.maxPoolSize.

Please see the Appendix on hibernate integration in c3p0's docs.

For any single c3p0 DataSource, there will be precisely one pool per user authentification. In the most common case, when clients use only the default getConnection() method, a DataSource maps to a single pool, which expands and contracts with load, depending upon your configuration.

If multiple user-authentifications make use of the same DataSource [that is, if client applications sometimes call ds.getConnection( user, pwd )], then for each user-authentification to the database, there will be one distinct pool. getNumUserPools() returns the number of such pools, which will be the same as the number of authentification credenials (including the default creditials) the DataSource has seen.

Re your final question/example if a SINGLE database user is interacting with a single c3p0 DataSource, only one internal pool would be created, and getNumUserPools() would return 1.

Hope this helps!
Steve


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 15, 2007 5:50 pm 
Newbie

Joined: Wed Jan 10, 2007 5:15 pm
Posts: 7
Thanks! That clarified a few things that I suspected.


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