- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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 are the methods provided by the ResultSet to navigate through it in JDBC?
We have two types of ResultSet objects namely, forward Only and, bi-directional as the names suggest you can move in only one direction (forward) in forward only ResultSet and, in bidirectional ResultSet you can move the pointer in both directions. The ResultSet interface provides several methods to navigate through both types of ResultSet objects.
Following table lists various methods to navigate through ResultSet object.
Method | Description |
---|---|
next() | This method moves the resultset pointer one row forward. |
Previous() | This method moves the resultset pointer one row backward. |
first() | This method moves the resultset pointer to the first row. |
last() | This method moves the resultset pointer to the last row. |
relative() | This method accepts an integer value representing the number of rows and, moves the resultset pointer forward or backward by given number of rows (positive integer forward, negative integer backward). |
absolute() | This method accepts an integer value representing the number of rows and, moves the resultset pointer to the given position in the resultset (starting from 1). If you pass a positive integer to the resultset then the pointer is moved to the given position starting from first of the result set. If you pass a negative integer to the resultset then the pointer is moved to the given position starting from last of the result set. |
beforeFirst() | This method moves the resultset pointer to its default position i.e. before first. |
afterLast() | This method positions the resultset pointer after the last row. |
- Related Articles
- How to Navigate through a ResultSet using a JDBC program?
- What is ResultSet holdability in JDBC?
- What is Type_FORWARD_ONLY ResultSet in JDBC?
- What is TYPE_SCROLL_INSENSITIVE ResultSet in JDBC?
- What is TYPE_SCROLL_SENSITIVE 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?
- How to get the row count from ResultSet in JDBC
- How to move the ResultSet cursor to the next row in JDBC?
- How to move the ResultSet cursor to the previous row in JDBC?
- How to move the ResultSet cursor to the last row in JDBC?
- How to move the ResultSet cursor to the first row in JDBC?
- What are the services provided by the Network Layer?
- What are the services provided by the transport layer?

Advertisements