I have the following code snippet:
PreparedStatement preparedStatement = connection.prepareStatement(sql);
for (int i = 0; i < 100000; i++) {
preparedStatement.setObject(1, someValue);
preparedStatement.addBatch();
if ((i + 1) % 100 == 0) {
preparedStatement.executeBatch();
}
}
so I want to execute one command around 100 000 times with different values. My question is: are the parameters from the PreparedStatement cleared after each call to executeBatch() or do I have to explicitly call preparedStatement.clearParameters() after calling executeBatch() in order to make sure that there will be executed only the last 100 commands?