Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

c3p0 mysql hibernate configuration

Posted on 2013-05-18
10
Medium Priority
?
231 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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
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 2000 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

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…
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses

885 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