title: java try with resources : empty result set
body: <p>I am trying to update a user in my db with a java try-with-resources statement. I however get an error message returned that my resultset is empty. Having read various other posts, they suggest to use ps.executeUpdate() instead of ps.executeQuery(), but this returns an int which (stating the glaringly obvious) does not have the type "Auto closable", which means the code does not even pass compile. </p>
  
  <p>Does anyone have an example of how to bypass this?   </p>
  
  <pre><code>public void updateUser (String id, String value){
  
      try (Connection con = DriverManager.getConnection("jdbc:databasetype://localhost:5432/database");
           PreparedStatement ps = createUpdateStatement(con, id, value);
           ResultSet rs = ps.executeQuery())
      {
          System.out.println("Add operation completed");
      } catch(Exception e) {
          System.out.println("Exception: " + e.getMessage() + " Thrown by: " + e.getClass().getSimpleName());
      }
  }
  </code></pre>