Hi,
I have a web application with struts and hibernate 3.6.8 and I'm using c3p0 as datasource for hibernate. I'm having a problem with the connections opened.
My database is oracle and I have an user that can have 10 connections as max, thus in the hibernate.cfg.xml I set 9 as c3p0.max_size but I receive an exception because the max of sessions has been exceded.
As I receive this exception, I decrease the max number of connections in hibernate.cfg.xml. Now, I have 7 connections but yesterday I receive the same exception. I have search in the code I didn't find any place where I can leave opened some conecction, thus I'm very lost. I don't understand this problem and I don't know why happens.
Somebody could help me???, please!
Code:
2012-12-11 11:03:15,887 WARN com.mchange.v2.resourcepool.BasicResourcePool > com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@ff5df0 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:
java.sql.SQLException: ORA-02391: s'ha excedit el límit del paràmetre SESSIONS_PER_USER simultànies, màxim
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
This is my hibernate.cfg.xml
Code:
<property name="hibernate.bytecode.use_reflection_optimizer">false</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<property name="hibernate.connection.autocommit">false</property>
<property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
<property name="hibernate.connection.password">----</property>
<property name="hibernate.connection.url">----</property>
<property name="hibernate.connection.username">-----</property>
<property name="hibernate.current_session_context_class">thread</property>
<property name="hibernate.default_schema">--------</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="hibernate.format_sql">true</property>
<property name="hibernate.search.autoregister_listeners">false</property>
<property name="hibernate.show_sql">false</property>
<!-- configuration pool via c3p0-->
<property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
<property name="c3p0.acquire_increment">1</property>
<property name="c3p0.idle_test_period">100</property> <!-- seconds -->
<property name="c3p0.max_size">7</property>
<property name="c3p0.max_statements">0</property>
<property name="c3p0.min_size">1</property>
<property name="c3p0.timeout">100</property> <!-- seconds -->
Thanks in advance.
Regards.
Marcos.