-
1. Re: This method should only be called on ResultSet objects that are scrollable
cfang Jan 4, 2019 2:01 PM (in response to richardmoore)What's the full stack trace? especially the line from jberet-support JdbcItemReader class, and then we can trace it further. These problems tend to be jdbc driver specific.
-
2. Re: This method should only be called on ResultSet objects that are scrollable
richardmoore Jan 9, 2019 5:26 PM (in response to cfang)Added log.
-
3. Re: This method should only be called on ResultSet objects that are scrollable
cfang Jan 9, 2019 6:21 PM (in response to richardmoore)Copied the stack trace lines from the log file:
com.ibm.db2.jcc.am.SqlException: [jcc][t4][10179][10900][4.16.53] This method should only be called on ResultSet objects that are scrollable (type TYPE_SCROLL_SENSITIVE or TYPE_SCROLL_INSENSITIVE). ERRORCODE=-4476, SQLSTATE=null
at com.ibm.db2.jcc.am.fd.a(fd.java:723) ~[db2jcc4.jar:?]
at com.ibm.db2.jcc.am.fd.a(fd.java:60) ~[db2jcc4.jar:?]
at com.ibm.db2.jcc.am.fd.a(fd.java:120) ~[db2jcc4.jar:?]
at com.ibm.db2.jcc.am.ResultSet.checkThatResultSetTypeIsScrollable(ResultSet.java:4615) ~[db2jcc4.jar:?]
at com.ibm.db2.jcc.am.ResultSet.scrollableCheck(ResultSet.java:1585) ~[db2jcc4.jar:?]
at com.ibm.db2.jcc.am.ResultSet.absolute(ResultSet.java:2289) ~[db2jcc4.jar:?]
at org.apache.commons.dbcp2.DelegatingResultSet.absolute(DelegatingResultSet.java:415) ~[commons-dbcp2-2.1.jar:2.1]
at org.apache.commons.dbcp2.DelegatingResultSet.absolute(DelegatingResultSet.java:415) ~[commons-dbcp2-2.1.jar:2.1]
at org.jberet.support.io.JdbcItemReader.open(JdbcItemReader.java:221) ~[jberet-support-1.3.0.Final.jar:?]
at org.jberet.runtime.runner.ChunkRunner.run(ChunkRunner.java:197) [jberet-core-1.3.0.Final.jar:1.3.0.Final]
at org.jberet.runtime.runner.StepExecutionRunner.runBatchletOrChunk(StepExecutionRunner.java:225) [jberet-core-1.3.0.Final.jar:1.3.0.Final]
at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:144) [jberet-core-1.3.0.Final.jar:1.3.0.Final]
at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:164) [jberet-core-1.3.0.Final.jar:1.3.0.Final]
at org.jberet.runtime.runner.CompositeExecutionRunner.runFromHeadOrRestartPoint(CompositeExecutionRunner.java:88) [jberet-core-1.3.0.Final.jar:1.3.0.Final]
at org.jberet.runtime.runner.JobExecutionRunner.run(JobExecutionRunner.java:60) [jberet-core-1.3.0.Final.jar:1.3.0.Final]
at org.jberet.spi.JobExecutor$1.run(JobExecutor.java:99) [jberet-core-1.3.0.Final.jar:1.3.0.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_191]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_191]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_191]
The throwing line in JdbcItemReader:
jsr352/JdbcItemReader.java at 1.3.x · jberet/jsr352 · GitHub
if (readyPosition >= 0) { resultSet.absolute(readyPosition); } The api doc for ResultSet.absolute(int) method:
ResultSet (Java Platform SE 8 )
Moves the cursor to the given row number in this
ResultSet
object.If the row number is positive, the cursor moves to the given row number with respect to the beginning of the result set. The first row is row 1, the second is row 2, and so on.
If the given row number is negative, the cursor moves to an absolute row position with respect to the end of the result set. For example, calling the method
absolute(-1)
positions the cursor on the last row; calling the methodabsolute(-2)
moves the cursor to the next-to-last row, and so on.If the row number specified is zero, the cursor is moved to before the first row.
An attempt to position the cursor beyond the first/last row in the result set leaves the cursor before the first row or after the last row.
Note: Calling
absolute(1)
is the same as callingfirst()
. Callingabsolute(-1)
is the same as callinglast()
.- Parameters:
row
- the number of the row to which the cursor should move. A value of zero indicates that the cursor will be positioned before the first row; a positive number indicates the row number counting from the beginning of the result set; a negative number indicates the row number counting from the end of the result set- Returns:
true
if the cursor is moved to a position in thisResultSet
object;false
if the cursor is before the first row or after the last row- Throws:
SQLException
- if a database access error occurs; this method is called on a closed result set or the result set type isTYPE_FORWARD_ONLY
SQLFeatureNotSupportedException
- if the JDBC driver does not support this method
-
4. Re: This method should only be called on ResultSet objects that are scrollable
cfang Jan 9, 2019 6:38 PM (in response to cfang)JdbcItemReader uses TYPE_FORWARD_ONLY as the default ResultSet scrollability property, but this causes error you encourtered when positioning the cursor to the desired position via calling ResultSet.absolute(int). It's worth investigating whether it makes more sense to use
TYPE_SCROLL_INSENSITIVE
as the default scrollability property in jberet-support JdbcItemReader. For now, the best option is to explicitly set the ResultSet scrollability property, as you did as workaround:<property name="resultSetProperties" value="resultSetType=TYPE_SCROLL_INSENSITIVE"/>
-
5. Re: This method should only be called on ResultSet objects that are scrollable
cfang Jan 9, 2019 7:12 PM (in response to cfang)This seems to be a known issue with db2. See the following JBeret JIRA issue:
jdbcItemReader on DB2: this method should only be called on ResultSet objects that are scrollable (type TYPE_SCROLL_SENSITIVE or TYPE_SCROLL_INSENSITIVE
I also created the following jberet JIRA task to investigate any improvement for db2 configuration:
ResultSet scrollability property configuration in JdbcItemReader for db2