Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java sql SQLRecoverableException Closed Connection

908707Jan 4 2013 — edited Jan 14 2015
Hi,

We have been facing this 'java.sql.SQLRecoverableException: Closed Connection' issue in test environment.

Below is the stack trace:

— Check the SQL Statement (preparation failed).
— Cause: java.sql.SQLRecoverableException: Closed Connection; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
— Check the SQL Statement (preparation failed).
— Cause: java.sql.SQLRecoverableException: Closed Connection

Some background around the issue:

We have below tables TABLE_X,TABLE_Y

TABLE_X is parent of TABLE_Y i.e TABLE_Y records are childs of TABLE_X record and there can be more than one child for the parent record.
We have the Referential Integrity constraint on the relation and also a non unique index.

The insertion of new record into TABLE_Y has to be thread safe(with in the parent), due to application design limitations we are locking the parent record in TABLE_X for each child creation in TABLE_Y(You may wonder why insertion has to be thread safe, it is the design issue)

The lock is implemented by using select for update on parent record. With this select for update I understand it is obvious that app may experience the NOWAIT at times.

What has bugging me is why the app is facing this ClosedConnection, Please help me in understanding this issue.

We use Oracle11g with iBatis +Spring.
Server: Tomcat

Server connection entry:

<Resource
name="jdbc/xyzSchema"
dataSourceName="jdbc/xyzSchema"
auth="Container"
factory="org.apache.naming.factory.BeanFactory"
type="com.mchange.v2.c3p0.ComboPooledDataSource"
driverClass="oracle.jdbc.OracleDriver"
jdbcUrl="jdbc:oracle:thin:@test-host:1521:DSTEST1"
user="TEST"
password="TEST"
initialPoolSize="1"
maxPoolSize="20"
minPoolSize="7"
acquireIncrement="2"
maxConnectionAge="1500"
maxIdleTime="1500"
maxIdleTimeExcessConnections="300"
checkoutTimeout="120000"
unreturnedConnectionTimeout="300"
loginTimeout="0"
debugUnreturnedConnectionStackTraces="false"
maxStatementsPerConnection="100"
numHelperThreads="3"
idleConnectionTestPeriod="900"
preferredTestQuery="SELECT 1 FROM dual"
testConnectionOnCheckin="false"
testConnectionOnCheckout="false"
/>

Please help me in understanding the issue.

Thanks
Praveen
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 1 2013
Added on Jan 4 2013
1 comment
3,360 views