title: JDBC PreparedStatement.setString() not working properly with SQLite?
body: <p>I'm using Xerials SQLite JDBC driver and want to do the simplest thing you can imagine:</p>
  
  <p>I have created the following table:</p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS households (hostname_id_pk INTEGER PRIMARY KEY, hostname TEXT UNIQUE, vm TEXT);
  </code></pre>
  
  <p>Now, as I want a parametrized insertion statment I use PreparedStatment as follows:</p>
  
  <pre><code>public static void main(String[] args) throws ClassNotFoundException {
      Class.forName("org.sqlite.JDBC");
      Connection con = null;
      PreparedStatement updateHouseholdStmt = null;
  
      try {
          con = DriverManager.getConnection(DB_IDENTIFIER);           
  
          String getHouseholdString = "SELECT hostname_id_pk FROM households WHERE hostname = ?";
          String updateHouseholdString = "INSERT INTO households (hostname, vm) values(?, 'VM1')";
  
          getHouseholdStmt = con.prepareStatement(getHouseholdString);
          getHouseholdStmt.setString(1, "test1");
  
          updateHouseholdStmt = con.prepareStatement(updateHouseholdString);
          getHouseholdStmt.setString(1, "test1");
  
          ResultSet hhRS = getHouseholdStmt.executeQuery();
          int hhId = -1;
  
          if(hhRS.next()){
              hhId = hhRS.getInt(1);
              System.out.println(hhId);
          } else {
              System.out.println(updateHouseholdStmt.executeUpdate());
          }
  
      } catch (SQLException e) {
          System.err.println(e.getMessage());
      } finally {
          try {
              if (con != null) {
                  con.close();
              }
              if (getHouseholdStmt != null){
                  getHouseholdStmt.close();
              }
              if (updateHouseholdStmt != null) {
                  updateHouseholdStmt.close();
              }
          } catch (SQLException e) {
              System.err.println(e);
          }
      }
  
  }
  </code></pre>
  
  <p>In this case, the only thing I can find in the DB is a new entry with <code>(1, , VM1)</code> meaning that the entry is created, but the string parameter is missing for some reason.</p>
  
  <p>When I'm replacing the "?" in the <code>updateHousholdStatement()</code> with a sample value and remove the <code>.setString(...)</code> method line everything works fine.</p>
  
  <p>What the heck am I missing?! I already checked this a thousand times this morning.</p>
  
  <p>Thx in advance. </p>