title: select few rows from resultset mysql java
body: <p>i have used a select command in my java program and stored its value in the result set. now while looping in the resultset i want to use a select command which will select the first 5 lines of the resultset and insert into other table. for the second time, it should select the next 5 lines and insert into the table. and for the third time, so on..</p>
  
  <pre><code>Statement s = connection.createStatement();
  s.executeQuery("Select * from table1");
  ResultSet res = s.getResultSet();
  while(res.next()){
   // here i want to select the first 5 lines of the result set and insert in the second       table
  }
  </code></pre>