Result set is closed
richardmoore Aug 4, 2016 9:40 AMI am reading from a DB2 table and writing the results out as a pipe delimited file when the read fails because the new DB2 driver will not allow next() when the last resultset has been reached without getting a ERRORCODE=-4470, SQLSTATE=null. According to documentation I found IBM says that the following should be set to avoid this error but I do not know how to pass this for the jdbcItemReader to use - allowNextOnExhaustedResultSet=DB2BaseDataSource.YES
I tried passing it as a properties with both of the following -
<property name="property" value="allowNextOnExhaustedResultSet=DB2BaseDataSource.YES"/>
<property name="property" value="allowNextOnExhaustedResultSet-DB2BaseDataSource.YES"/>
<chunk>
<reader ref="jdbcItemReader">
<properties>
<property name="url" value="jdbc:db2://trhdb2:60000/awgt1"/>
<property name="user" value="myId"/>
<property name="password" value="myPswd"/>
<property name="sql" value="SELECT fclty_cd, fclty_ltr2_cd, fclty_nm, dw_fclty_ltr2_cd FROM db2pdba.aim_fclty" />
<property name="beanType" value="java.util.List" />
</properties>
</reader>
<writer ref="csvItemWriter">
<properties>
<property name="resource" value="MyBatchletTest_test.out" />
<!-- <property name="writeMode" value="#{jobParameters['writeMode']}?:append;"/>
<property name="writeMode" value="#{jobParameters['writeMode']}?:failIfExists;"/> -->
<property name="writeMode" value="overwrite" />
<property name="preference" value="STANDARD_PREFERENCE" />
<property name="delimiterChar" value="|" />
<property name="quoteChar" value="^" />
<property name="beanType" value="java.util.List" />
<property name="header" value="fclty_cd, fclty_ltr2_cd, fclty_nm, dw_fclty_ltr2_cd" />
<property name="writeComments" value="# Comments written by csv writer." />
</properties>
</writer>
</chunk>
com.ibm.db2.jcc.am.SqlException: [jcc][t4][10120][10898][3.63.123] Invalid operation: result set is closed. ERRORCODE=-4470, SQLSTATE=null
at com.ibm.db2.jcc.am.fd.a(fd.java:663) ~[db2jcc.jar:?]
at com.ibm.db2.jcc.am.fd.a(fd.java:60) ~[db2jcc.jar:?]
at com.ibm.db2.jcc.am.fd.a(fd.java:103) ~[db2jcc.jar:?]
at com.ibm.db2.jcc.am.vn.Db(vn.java:4528) ~[db2jcc.jar:?]
at com.ibm.db2.jcc.am.vn.B(vn.java:2184) ~[db2jcc.jar:?]
at com.ibm.db2.jcc.am.vn.getRow(vn.java:2172) ~[db2jcc.jar:?]
at org.jberet.support.io.JdbcItemReader.readItem(JdbcItemReader.java:304) ~[jberet-support-1.3.0.Beta2.jar:1.3.0.Beta2]
at org.jberet.runtime.runner.ChunkRunner.readItem(ChunkRunner.java:359) ~[jberet-core-1.3.0.Beta2.jar:1.3.0.Beta2]
at org.jberet.runtime.runner.ChunkRunner.readProcessWriteItems(ChunkRunner.java:305) ~[jberet-core-1.3.0.Beta2.jar:1.3.0.Beta2]
at org.jberet.runtime.runner.ChunkRunner.run(ChunkRunner.java:201) [jberet-core-1.3.0.Beta2.jar:1.3.0.Beta2]
at org.jberet.runtime.runner.StepExecutionRunner.runBatchletOrChunk(StepExecutionRunner.java:226) [jberet-core-1.3.0.Beta2.jar:1.3.0.Beta2]
at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:147) [jberet-core-1.3.0.Beta2.jar:1.3.0.Beta2]
at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:164) [jberet-core-1.3.0.Beta2.jar:1.3.0.Beta2]
at org.jberet.runtime.runner.CompositeExecutionRunner.runJobElement(CompositeExecutionRunner.java:128) [jberet-core-1.3.0.Beta2.jar:1.3.0.Beta2]
at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:203) [jberet-core-1.3.0.Beta2.jar:1.3.0.Beta2]
at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:164) [jberet-core-1.3.0.Beta2.jar:1.3.0.Beta2]
at org.jberet.runtime.runner.CompositeExecutionRunner.runFromHeadOrRestartPoint(CompositeExecutionRunner.java:88) [jberet-core-1.3.0.Beta2.jar:1.3.0.Beta2]
at org.jberet.runtime.runner.JobExecutionRunner.run(JobExecutionRunner.java:60) [jberet-core-1.3.0.Beta2.jar:1.3.0.Beta2]
at org.jberet.spi.JobExecutor$1.run(JobExecutor.java:99) [jberet-core-1.3.0.Beta2.jar:1.3.0.Beta2]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_73]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_73]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_73]