• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 247
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

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