javajdbccachedrowset

How can i get the original values of specific column of cachedrowset?


it returns the current value of the select column, all i need is to return the original value for checking if the value really changed.

while(rs.next()){
    if (rs.rowUpdated){
        String strOrigVal = "";
        rs.getOriginalRow();
        strOrigVal = rs.getString("col1");
    }
}

Solution

  • ResultSet getOriginalRow()
                         throws SQLException
    
    while(rs.next()){
      if (rs.rowUpdated){
          String strOrigVal = "";
          ResultSet ors = rs.getOriginalRow(); //you should catch the return value
          if(ors.next()){ //move to the first cursor
            strOrigVal = ors.getString("col1");
          }    
      }
    }