I copied the following example from the SQLite Java library website:
PreparedStatement prep = conn.prepareStatement("insert into people values (?, ?);");
prep.setString(1, "Gandhi");
prep.setString(2, "politics");
prep.addBatch();
prep.setString(1, "Turing");
prep.setString(2, "computers");
prep.addBatch();
conn.setAutoCommit(false);
prep.executeBatch();
conn.setAutoCommit(true);
I am trying to understand the meaning of switching autoCommit()on each side executeBatch(). Does this just prevent committing for each individual batch operation? Thus, one “bulk” fixate will be made setAutoCommit(true).
Thank.
source
share