NullpointerException at PreparedStatement.executeBatch by setting "Com

One Star

NullpointerException at PreparedStatement.executeBatch by setting "Com

hi;
I use the tTeradataOutput in Java.
when Input_row.NB_LINE mod CommityEvery = 0
NullPointerException by PreparedStatement.executeBatch because it did not call PreparedStatement.addBatch.
/**
* start
*/
currentComponent = "tTeradataOutput_1";
try {
pstmt_tTeradataOutput_1.executeBatch();
insertedCount_tTeradataOutput_1 += pstmt_tTeradataOutput_1
.getUpdateCount();
} catch (java.sql.BatchUpdateException e) {
System.err.println(e.getMessage());
}

Please call method only when it is necessary.
/**
* start
*/
currentComponent = "tTeradataOutput_1";
//##### add.start
if (commitCounter_tTeradataOutput_1 > 0) {
//##### add.end
try {
pstmt_tTeradataOutput_1.executeBatch();
insertedCount_tTeradataOutput_1 += pstmt_tTeradataOutput_1
.getUpdateCount();
} catch (java.sql.BatchUpdateException e) {
System.err.println(e.getMessage());
}
//##### add.start
} // end of commitCounter_tTeradataOutput_1 >0
//##### add.end

I think it is the same as "Use Batch(Batch size)".
Regards