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
Solved

c3p0 mysql hibernate configuration

Posted on 2013-05-18
10
184 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
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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ejb on wildfly 5 30
Apache module 5 46
Uploading a CSV Data Import via PHP & MySql 3 30
Redirect old website to new website in subfolder using .htaccess 2 19
Creating and Managing Databases with phpMyAdmin in cPanel.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

856 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