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
|