The following ItemReader bean read rows via PrestDriver. When executing the batch I am getting the this error message:
org.springframework.batch.core.step.skip.NonSkippableReadException: Non-skippable exception during read
at org.springframework.batch.core.step.item.FaultTolerantChunkProvider.read(FaultTolerantChunkProvider.java:105) ~[spring-batch-core-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.batch.core.step.item.SimpleChunkProvider$1.doInIteration(SimpleChunkProvider.java:126) ~[spring-batch-core-4.2.4.RELEASE.jar:4.2.4.RELEASE]
.....
Caused by: org.springframework.dao.InvalidDataAccessApiUsageException: Attempt to process next row
failed; SQL [SELECT * FROM ......]; getRow; nested exception is
java.sql.SQLFeatureNotSupportedException: getRow
ItemReader code
@Bean
public ItemReader<ExportDto> itemReader() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.facebook.presto.jdbc.PrestoDriver");
dataSource.setUrl("jdbc:presto: ");
dataSource.setUsername("....");
dataSource.setPassword("....");
JdbcCursorItemReader<ExportDto> reader = new JdbcCursorItemReader<ExportDto>();
reader.setDataSource(dataSource);
reader.setSql("SELECT * FROM .....'");
BeanPropertyRowMapper<ExportDto> rowMapper = new BeanPropertyRowMapper<>(ExportDto.class);
reader.setRowMapper(rowMapper);
return reader;
}
I have created an “hello world” app in order to test the driver, this time using plain JDBCDriver. This test was successful.
String url = "jdbc:presto:.....";
Properties properties = new Properties();
properties.setProperty("user", "....");
properties.setProperty("password", "....");
properties.setProperty("SSL", "true");
try {
Connection conn = DriverManager.getConnection(url, properties);
if (conn == null) {
System.out.print("NULL");
} else {
Statement stmt = conn.createStatement();
String sql = "SELECT distinct .....";
ResultSet rs = stmt.executeQuery(sql);
// Extract data from result set
while (rs.next()) {
// Retrieve by column name
String programs = rs.getString("prg");
}
// Clean-up environment
rs.close();
stmt.close();
conn.close();
}
Any ideas why this happen? or some workarounds will be appreciated.
Thank you
By default, the JdbcCursorItemReader
verifies the cursor's position after each processed row. This check involves a call to ResultSet#getRow() which does not seem to be supported as mentioned in the comment above.
You can disable this check using JdbcCursorItemReader#setVerifyCursorPosition
until this feature is supported in the Presto Driver.