I have a table that I need to insert records into, the id field is a primary auto_increment field, I am not sure about what isolation level I should use such that no record will be created with the same id when 2 concurrent transactions are working? this is my code:
String query = "insert into InstrumentTable values(?,?,?,? )";
Connection con = null;
PreparedStatement prepedStatement = null;
try {
con = connectionPool.getConnection();
con.setAutoCommit(false);
prepedStatement = con.prepareStatement(query);
prepedStatement.setString(1, type);
prepedStatement.setInt(2, permissionLevel);
prepedStatement.setInt(3, slotTime);
prepedStatement.setString(4, description);
prepedStatement.executeUpdate();
con.commit();
}
thanks