这是我的代码:
String sql = "INSERT INTO TABLE1 (CEREVENTID,TRANSACTIONID,CLIENTCREDENTIALSID,EVENTDATETIME,SENTDATETIME,AUXID,CLIENTID) VALUES (?,?,?,?,?,?,?)";
this.getNetezzaJDBCTemplate().batchUpdate(sql, new BatchPreparedStatementSetter()
{
@Override
public void setValues(PreparedStatement ps, int i) throws SQLException
{
Event event = events.get(i);
ps.setLong(1, event.getCEREventID());
ps.setLong(2, event.getTransactionID());
ps.setLong(3, event.getClientCredentialsID());
ps.setTimestamp(4, event.getEventDateTime());
ps.setTimestamp(5, event.getSentDateTime());
ps.setLong(6, event.getAuxID());
ps.setString(7, event.getClientID() );
}
@Override
public int getBatchSize()
{
return events.size();
}
}
这是一个错误:
Exception in thread "main" org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [INSERT INTO TABLE1 (CEREVENTID,TRANSACTIONID,CLIENTCREDENTIALSID,EVENTDATETIME,SENTDATETIME,AUXID,CLIENTID)VALUES (?,?,?,?,?,?,?)]; SQL state [HY010]; error code [11410]; No value specified for parameter 1; nested exception is org.netezza.error.NzSQLException: No value specified for parameter 1
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:605)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:617)
at org.springframework.jdbc.core.JdbcTemplate.batchUpdate(JdbcTemplate.java:890)
at com.omnitracs.fra.dao.EventDAO.insertEvents(EventDAO.java:117)
at com.omnitracs.fra.main.CriticalEventMain.main(CriticalEventMain.java:76)
Caused by: org.netezza.error.NzSQLException: No value specified for parameter 1
at org.netezza.internal.NzPreparedQuery.toNativeString(NzPreparedQuery.java:627)
at org.netezza.internal.QueryExecutor.sendQuery(QueryExecutor.java:450)
at org.netezza.internal.QueryExecutor.execute(QueryExecutor.java:72)
at org.netezza.sql.NzConnection.execute(NzConnection.java:2673)
at org.netezza.sql.NzStatement._execute(NzStatement.java:849)
at org.netezza.sql.NzStatement._executeUpdate(NzStatement.java:860)
at org.netezza.sql.NzPreparedStatament.executeBatch(NzPreparedStatament.java:991)
at org.springframework.jdbc.core.JdbcTemplate$4.doInPreparedStatement(JdbcTemplate.java:905)
at org.springframework.jdbc.core.JdbcTemplate$4.doInPreparedStatement(JdbcTemplate.java:890)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:589)
... 4 more
我已将字段/列的总数减少到7(从66开始),因此更容易排除故障,但仍然没有运气。
我该如何调试?请帮忙。