Use ResultSet repeated (multiple times)

For the accessing of ResultSet is through cursor by using next() or previous, so as a matter of fact,  the cursor of database is moving.  To use the ResultSet repeated, you may use CachedRowSet to copy a ResultSet, then use the copied one.

 

For example,

 

ResultSet rs = cMetaSet.createCopyNoConstraints();
   while (rs.next())
   {
    if (fldIndex == index)
    {
      return rs.getInt(5);
    }
    index++;
   }

 

 

你可能感兴趣的:(database)