Sunday, 7 September 2014

Result set already closed; nested exception is java.sql.SQLException: Result set already closed : org.springframework.jdbc.UncategorizedSQLException”



I am getting below exception in spring batch framework.


Attempt to process next row failed; uncategorized SQLException for SQL "Written Query. and Query is not provided here for security reasons"; SQL state [null]; error code [0]; Result set already closed; nested exception is java.sql.SQLException: Result set already closed : org.springframework.jdbc.UncategorizedSQLException


Note: Query is fine not included here.


My xml looks like:



<bean id="itemReader" class="org.springframework.batch.item.database.JdbcCursorItemReader" scope="step">
<property name="dataSource" ref="dataSourceExt"/>
<property name="sql">
<value>
<![CDATA[ select statement]]>
</value>
</property>
<property name="rowMapper">
<bean class="org.RowMapper"/>
</property>
</bean>


Here we are using itemreader, chunking methods in the above step. My fetchsize is 50 and chunk commit size is 10. Ideally it should read 50 items from db and then for every 10 items a chunk should commit. But It is able to process a chunk of records(which is 10) and then i am getting above mentioned error. Error am getting at 11th record which comes under second chunk.


Even I make chunk size to 5 then also i am facing the same error. So the problem is not with chunk size it doesn't matter howmany records reside in the chunks and its failing exactly after one chunk. It seems to be the jdbc data source connection problem or JDBCCursorItemReader not sure .


Note 2: I am using latest spring batch 3.0 which is latest version.


Is it a problem related to the configuration or to JDBCCursorItemReader?


No comments:

Post a Comment