Note that there are some explanatory texts on larger screens.

plurals
  1. POToo many connections using Hibernate and mysql
    primarykey
    data
    text
    <p>I am using Hibernate 3 and mysql sever 5.5 for myweb application with spring 3.0</p> <p>I am getting exception as Too many connections......</p> <p>My java file where I create session is as follows:</p> <pre><code>public class DBConnection { static{ } public Session getSession(){ Session session = null; SessionFactory sessionFactory= null; sessionFactory = new Configuration().configure().buildSessionFactory(); session = sessionFactory.openSession(); return session; } } </code></pre> <p>and I call this method where I need session </p> <p>as </p> <pre><code>Session session=new DBConnection().getSession(); </code></pre> <p>and after</p> <pre><code>transaction.commit(); </code></pre> <p>I close session by using</p> <pre><code>session.close(); </code></pre> <p>please help me in solving problem.......</p> <p>my hibernate.cfg.xml is :</p> <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt; &lt;!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&gt; &lt;hibernate-configuration&gt; &lt;session-factory&gt; &lt;property name="hibernate.connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt; &lt;property name="hibernate.connection.url"&gt;jdbc:mysql://localhost:3306/dbname&lt;/property&gt; &lt;property name="hibernate.connection.username"&gt;root&lt;/property&gt; &lt;property name="hibernate.connection.password"&gt;lax&lt;/property&gt; &lt;property name="hibernate.connection.pool_size"&gt;100&lt;/property&gt; &lt;property name="show_sql"&gt;true&lt;/property&gt; &lt;property name="dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/property&gt; &lt;property name="hibernate.hbm2ddl.auto"&gt;update&lt;/property&gt; &lt;property name=""&gt;&lt;/property&gt; &lt;property name="hibernate.connection.release_mode"&gt;on_close&lt;/property&gt; &lt;/session-factory&gt; &lt;/hibernate-configuration&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload