Solved

c3p0 mysql hibernate configuration

Posted on 2013-05-18
10
198 Views
Last Modified: 2015-05-07
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
Comment
Question by:Ashok9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 39180902
You can change the value from 225 to a higher number.
0
 
LVL 5

Author Comment

by:Ashok9
ID: 39181166
Ideally it should reuse the connections. But why its not using existing connections? Also all the connections are sleeping...?
0
 
LVL 23

Expert Comment

by:nemws1
ID: 39182683
Have you set max_statements? (I'm just guessing here)

  <property name="hibernate.c3p0.max_statements">50</property>
0
Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

 
LVL 5

Author Comment

by:Ashok9
ID: 39186255
what does max_statements do? Does it stop using connection after the max_statements?
0
 
LVL 5

Author Comment

by:Ashok9
ID: 39186256
I tried it with the value of 10. but it was of no use it again makes connections to sleep mode.
0
 
LVL 1

Expert Comment

by:dcpetersonp
ID: 39192075
0
 
LVL 2

Accepted Solution

by:
c_kedar earned 500 total points
ID: 39854292
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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question