title: inserting java values to sqlite database
body: <p>This is a java inserting values to database problem.</p>
  
  <p>I want to insert data into my database but I get an exception that states "Query does not return results". What am I doing wrong? What should I return?</p>
  
  <p>This is my function code:</p>
  
  <pre><code>public void commitToDB(String fName) throws SQLException {
      PreparedStatement preparedStatement = null;
      ResultSet resultSet = null;
      String query = "INSERT INTO users (firstname)" + " VALUES (?)";
      try {
          preparedStatement = connection.prepareStatement(query);
          preparedStatement.setString(1, fName);
  
          // execute the preparedstatement
          resultSet = preparedStatement.executeQuery();
      }
      catch(Exception e) {
          System.out.println("Got an exception");
          System.out.println(e.getMessage());           
      }
      finally {
          preparedStatement.close();
          resultSet.close();
      }
  }   
  </code></pre>