title: How do I return multiple rows from a JDBC method?
body: <p>I am currently learning JDBC and can successfully query and retrieve data from a MysQL database. But I would like to run this as a method and return the resultset rows from the method to the calling program.</p>
  
  <p>So far I think I have made an appropriate method but am stuck returning the resultset as an <code>object</code>. Eclipse gives me the following error for the return type:</p>
  
  <blockquote>
    <p>Object cannot be resolved to a type</p>
  </blockquote>
  
  <p>Here is the method:</p>
  
  <pre><code>public object getAllPosts(int catID) throws Exception{
      try{
          this.catID = catID;
          sql = "SELECT post_id, post_title, post_content, post_date FROM crm_posts WHERE cat_id = ? LIMIT ?";
          prep = conn.prepareStatement(sql);
          prep.setInt(1, catID);
          prep.setInt(2, 3);
          // execute statement
          rs = prep.getResultSet();
  
      } catch(Exception e){
          e.printStackTrace();
      }
      return rs;
  }
  </code></pre>
  
  <p>What is the return type I should use or is there a better way of doing this?</p>
  
  <p>EDIT:</p>
  
  <p>As stated in the comments it was a (annoying) typo. <code>Object</code> with a capital <code>O</code>.</p>