Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
izumisawaa
Contributor
Contributor

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
Labels (3)
0 Replies