-->
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: Help: urge advice to release mysql connection
PostPosted: Thu Oct 19, 2006 11:17 am 
Beginner
Beginner

Joined: Mon May 22, 2006 12:12 am
Posts: 23
Hi Experts!


using MySQL5 w/ NHibernate; writing WinForm application in C#.

my max_user_connection is easily reached>>>

during the stages of testing in pre-matured applications, I hit error after several rounds of testings. The error states that the max_user_connection (which I've already set to 100) of mysql has been reached. This is so easily reached even only one person using my program? (1 to less than 10 objects be saved in one save operation; definitely less than 100 objects so far on reading objects at each read operation). I may reach the error after 10-20 rounds of these operations.

my confusion in coding to release connection/session(disconnect)? (are they hooking the connections) >>>

Then, I think my code has not well close the session??? in fact, I'm not sure what to do: my app followed some examples whereby a session utility class is be used; system creates a SessionFactory when is not available or takes an existing SessionFactory static object if already available. This was to reduce the need to create expensive connection. So, in short, I am supposed to have one SessionFactory in my app. which serves the sessions and transactions be used.

For the Session objects, I don't know if I should use session.close() or session.disconnect() after each successful read/save?


In short, the SessionFactory I never explicitly closes it; the sessions I explicitly close them. Is it wrong using this way to handle sessionFactory/session? Is this the cause for using up the connections and never released?

Could anyone briefly tells what should be the best way (when and what commands) to release the connections (at which point to release them)?


Thanks!
jackLing


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 20, 2006 10:11 am 
Beginner
Beginner

Joined: Mon May 22, 2006 12:12 am
Posts: 23
Hi all,


In fact that I also saw a message stating that all pooling connections have been used. Really need your guidance on how to code in the right way.


thanks,
jL


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.