-->
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.  [ 2 posts ] 
Author Message
 Post subject: Disable connection pooling
PostPosted: Fri Nov 19, 2010 1:31 am 
Newbie

Joined: Mon Sep 27, 2010 2:07 am
Posts: 3
As I have read somewhere on the forum, by not specifying the "hibernate.pool_size" parameter, database connection pooling would be turned off. I would expect Hibernate to create a connection for every session that is opened. This does not seem to be the case. Hibernate seems to create one connection and then retain that connection, which causes my application to suffer from the usual connection timeout issues.

Is there another way to totally disable connection pooling?


Top
 Profile  
 
 Post subject: Re: Disable connection pooling
PostPosted: Fri Nov 19, 2010 9:59 am 
Senior
Senior

Joined: Fri Oct 08, 2010 8:44 am
Posts: 130
Just set "hibernate.pool_size" parameter to zero.

Hibernate internal pool is very simple. It only checks this value when connection needs to be closed. So, if number of opened connections is not larger than "hibernate.pool_size" it retains connection in the open state. Setting the parameter to zero resolves this issue.

It is not possible to turn off the pooling at all (except by writing your own connection open provider or feeding connections to hibernate SessionFactory object yourself), but this solution should be fully enough for you.

If you want more technical details you can check out the code of following objects:

DriverManagerConnectionProvider - this is default pool provider,
SettingsFactory - this class chooses connection pool provider for you.


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