以下 ItemReader bean 通过 PrestDriver 读取行。执行批处理时,我收到此错误消息:
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 代码
@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;
}
我创建了一个“hello world”应用程序来测试驱动程序,这次使用的是普通的 JDBCDriver。本次测试成功。
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();
}
任何想法为什么会发生这种情况?或一些解决方法将不胜感激。
谢谢