I am getting 'SQL Closed connection' within my Java
application when connecting to my Oracle
Database.
Do I need to increase my timeout or make any other changes to my XML configuration?
Below is my persistence
.xml file:
<persistence-unit name="mypersistenceUnit">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>com.my.package.entities.Person</class>
<class>com.my.package.entities.Address</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
<property name="hibernate.connection.provider_class" value="org.hibernate.c3p0.internal.C3P0ConnectionProvider"/>
<property name="hibernate.c3p0.max_size" value="1"/>
<property name="hibernate.c3p0.min_size" value="1"/>
<property name="hibernate.c3p0.acquire_increment" value="2"/>
<property name="hibernate.c3p0.idle_test_period" value="300"/>
<property name="hibernate.c3p0.max_statements" value="15"/>
<property name="hibernate.c3p0.timeout" value="0"/>
<property name="hibernate.c3p0.unreturnedConnectionTimeout" value="30000"/>
<property name="hibernate.c3p0.dataSourceName" value="mypersistenceUnit JPA"/>
<property name="hibernate.jdbc.fetch_size" value="50"/>
<property name="hibernate.default_batch_fetch_size" value="10"/>
</properties>
</persistence-unit>
Perhaps the Connections Oracle is giving to you eventually time out or expire (despite the idle Connection tests you have configured). In any case, your Connection testing could be tighter, Connections that break between once-every-five-minute idle tests will be handed off to clients broken, perhaps provoking your Exception.
I'd add
<property name="hibernate.c3p0.testConnectionOnCheckout" value="true"/>
and see if that doesn't resolve the problem. See also c3p0's docs.