title: Reason for java.sql.SQLException "database in auto-commit mode"
body: <p>I use <code>sqlite</code> database and <code>java.sql</code> classes in servlet application to batch-insert some data into database.
  There are consecutive four inserts of different kinds of data.
  Each one looks like this:</p>
  
  <pre><code>PreparedStatement statement = conn
      .prepareStatement("insert or ignore into nodes(name,jid,available,reachable,responsive) values(?,?,?,?,?);");
  for (NodeInfo n : nodes)
  {
      statement.setString(1, n.name);
      statement.setString(2, n.jid);
      statement.setBoolean(3, n.available);
      statement.setBoolean(4, n.reachable);
      statement.setBoolean(5, n.responsive);
      statement.addBatch();
  }
  
  conn.setAutoCommit(false);
  statement.executeBatch();
  conn.commit();
  conn.setAutoCommit(true);
  statement.close();
  </code></pre>
  
  <p>But sometimes I get the </p>
  
  <pre><code>java.sql.SQLException: database in auto-commit mode
  </code></pre>
  
  <p>I found in source code of <code>java.sql.Connection</code> that this exception is thrown when calling <code>commit()</code> while database is in autocommit mode. But I turn autocommit off before and I can't see any place for some parallel execution related issues as for now application is only turned on once. </p>
  
  <p>Do you have any idea how to debug this issue? Maybe there's some other reason for this error (because I just found that exception about database not found or not well configured can be thrown when inserting <code>null</code> into non-null field)?.</p>