Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 292
  • Last Modified:

c3p0 mysql hibernate configuration

It creates 225 connections. so my tomcat serves for 225 requests and after that those connections goes to sleep mode in mysql. So further requests to tomcat are not responded. Please let me know what changes to be done to overcome this. Because this is currently in production.

Hibernate configuration

                <property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
                <property name="hibernate.c3p0.min_size">5</property>
                <property name="hibernate.c3p0.max_size">225</property>

Open in new window

0
Ashok9
Asked:
Ashok9
1 Solution
 
girionisCommented:
You can change the value from 225 to a higher number.
0
 
Ashok9Author Commented:
Ideally it should reuse the connections. But why its not using existing connections? Also all the connections are sleeping...?
0
 
nemws1Database AdministratorCommented:
Have you set max_statements? (I'm just guessing here)

  <property name="hibernate.c3p0.max_statements">50</property>
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
Ashok9Author Commented:
what does max_statements do? Does it stop using connection after the max_statements?
0
 
Ashok9Author Commented:
I tried it with the value of 10. but it was of no use it again makes connections to sleep mode.
0
 
dcpetersonpCommented:
0
 
c_kedarCommented:
Most probably, the transaction is not being closed in code. So on every request a connection is being checked out from the pool and is not being returned back to the pool.

Ensure call to transaction.commit() or transaction.rollback() is executed at the end of processing.

If you are using getSessionFactory().openSession() instead of getCurrentSession() then also ensure that session is closed with call to session.close().
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now