- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is TYPE_SCROLL_SENSITIVE ResultSet in JDBC?
This represents is a scrollable ResultSet i.e. the cursor moves in forward or backward directions. This type of ResultSet is sensitive to the changes that are made in the database i.e. the modifications done in the database are reflected in the ResultSet.
Which means if we have established a connection with a database using a JDBC program and retrieved a ResultSet holding all the records in a table named SampleTable. Meanwhile, if we have added some more records to the table (after retrieving the ResultSet), these recent changes will be reflected in the ResultSet object we previously obtained.
Following is an example which demonstrates how to create the TYPE_SCROLL_SENSITIVE result set.
Example
import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Statement; public class ScrollSensitive { public static void main(String[] args) throws Exception { //Registering the Driver DriverManager.registerDriver(new com.mysql.jdbc.Driver()); //Getting the connection String url = "jdbc:mysql://localhost/testdb"; Connection con = DriverManager.getConnection(url, "root", "password"); //Creating a Statement object Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); stmt.setFetchSize(1); } }
- Related Articles
- What is ResultSet holdability in JDBC?
- What is Type_FORWARD_ONLY ResultSet in JDBC?
- What is TYPE_SCROLL_INSENSITIVE ResultSet in JDBC?
- What is ResultSet Concurrency in JDBC?
- What is CONCUR_UPDATABLE ResultSet in JDBC? Explain?
- What is CONCUR_READ_ONLY ResultSet in JDBC? Explain?
- What is Result in JDBC? How to retrieve data from ResultSet object?
- How to insert rows into a ResultSet in JDBC?
- Explain the difference between RowSet and ResultSet in JDBC?
- How to get column count in a ResultSet in JDBC?
- How do you check if a ResultSet is empty or not in JDBC?
- How do you check if a ResultSet is closed or not in JDBC?
- How to Maintain an open ResultSet after commit in JDBC?
- How to get the row count from ResultSet in JDBC
- What are the methods provided by the ResultSet to navigate through it in JDBC?

Advertisements