title: java.sql.SQLException: Can not issue data manipulation statements with executeQuery()
body: <p>I can't seem to work out the bug. I need the ResultSet though to get the actual Object. The error is: <code>java.sql.SQLException: Can not issue data manipulation statements with executeQuery().</code> at <code>rs = pst.executeQuery();</code>. Code:</p>
  
  <pre><code>Connection con = null;
  PreparedStatement pst = null;
  ResultSet rs = null;
  
  String url = null; //Set, but not visible in code.
  String user = null; //Set, but not visible in code.
  String password = null; //Set, but not visible in code.
  
  public Object get(String table, String key){
      try {
          con = DriverManager.getConnection(url, user, password);
  
          String query = "SELECT * FROM `" + table + "` WHERE key = ?;";
          pst = con.prepareStatement(query);
  
          pst.setString(1, key);
          pst.executeUpdate();
  
          rs = pst.executeQuery();
  
          rs.next();
  
          return rs.getObject(1);
  
      } catch (SQLException ex) {
  
          return null;
  
      } finally {
          try {
              if (rs != null) {
                  rs.close();
              }
              if (pst != null) {
                  pst.close();
              }
              if (con != null) {
                  con.close();
              }
  
          } catch (SQLException ex) {
  
              return null;
  
          }
      }
  }
  </code></pre>