InterviewSolution
| 1. |
What's The Difference Between Type_scroll_insensitive , And Type_scroll_sensitive |
|
Answer» You will get a scrollable ResultSet object if you specify one of these ResultSet constants.The difference between the TWO has to do with WHETHER a result SET reflects changes that are made to it while it is OPEN and whether CERTAIN methods can be called to detect these changes. Generally speaking, a result set that is TYPE_SCROLL_INSENSITIVE does not reflect changes made while it is still open and one that is TYPE_SCROLL_SENSITIVE does. All three types of result sets will make changes visible if they are closed and then reopened: Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet .CONCUR_ READ_ ONLY);ResultSet srs = stmt.executeQuery("SELECT NAME, SALARY FROM PERSON"); srs.afterLast(); while (srs.previous()) { String name = srs.getString("NAME"); float salary = srs.getFloat("SALARY"); System.out.println(name + " " + salary); } You will get a scrollable ResultSet object if you specify one of these ResultSet constants.The difference between the two has to do with whether a result set reflects changes that are made to it while it is open and whether certain methods can be called to detect these changes. Generally speaking, a result set that is TYPE_SCROLL_INSENSITIVE does not reflect changes made while it is still open and one that is TYPE_SCROLL_SENSITIVE does. All three types of result sets will make changes visible if they are closed and then reopened: |
|