-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: problems with many connections to a database server
PostPosted: Thu Feb 26, 2009 12:14 pm 
Newbie

Joined: Thu Feb 26, 2009 11:50 am
Posts: 1
Hibernate version: 3


Code between sessionFactory.openSession() and session.close(): various

Name and version of the database you are using: MySQL 5.0.67

I wrote a web application in JSF that uses Hibernate as a persistence layer. This is a web-based "front end" for a database, so it communicates with the db server extensively. It is being run on Apache Tomcat.
My problem is that it creates enormous amounts of connections (which can be viewed as "connection threads" in the MySQL Administrator under 'Server Connections'). The connections disappear after a single session of the application makes use of them several times, so when a single user is using the application, there is no problem. But when several people use the application at the same time, the number of active connections grows quickly and in the end exceeds the allowed maximum. I get a DDoS...

I've tried to find a solution to this problem for some time, but haven't succeeded. I cannot find any way to limit the number of the connections that the application establishes with the database server.
Below is a part of my hibernate.cfg.xml file with the configuration of the db connection.

Code:
      <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
      <property name="hibernate.connection.username">***</property>
      <property name="hibernate.connection.password">***</property>
      <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/ies_dbo?useUnicode=true&amp;characterEncoding=UTF-8</property>
      <property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>

        <property name="hibernate.c3p0.acquire_increment">1</property>
      <property name="hibernate.c3p0.min_size">0</property>
      <property name="hibernate.c3p0.max_size">1</property>
      <property name="hibernate.c3p0.timeout">100</property>
      <property name="hibernate.c3p0.max_statements">0</property>
      <property name="hibernate.c3p0.idle_test_period">100</property>

        <!-- Enable Hibernate's automatic session context management -->
      <property name="current_session_context_class">thread</property>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.