What is TYPE_SCROLL_INSENSITIVE ResultSet in JDBC?

JDBCJava 8ProgrammingObject Oriented Programming

This represents a scrollable ResultSet i.e. the cursor moves in forward or backward directions. This type of ResultSet is insensitive to the changes that are made in the database i.e. the modifications done in the database are not reflected in the ResultSet.

Which means if we have established a connection with a database using JDBC program and retrieved a ResultSet holding all the records in a table named SampleTable and, meanwhile if we add some more records to the table (after retrieving getting the ResultSet), these recent changes will not be reflected in the ResultSet object we previously obtained.

Example

Consider we have a table named Employees in the database with the following contents:

+----+---------+--------+----------------+
| Id | Name    | Salary | Location       |
+----+---------+--------+----------------+
| 1  | Amit    | 3000   | Hyderabad      |
| 2  | Kalyan  | 4000   | Vishakhapatnam |
| 3  | Renuka  | 6000   | Delhi          |
| 4  | Archana | 9000   | Mumbai         |
| 5  | Sumith  | 11000  | Hyderabad      |
| 6  | Rama    | 11000  | Goa            |
+----+---------+--------+----------------+
raja
Published on 25-Mar-2019 15:21:59
Advertisements