ResultSet in JDBC- Types and Use

java.sql.ResultSet is an interface that can hold the records from the database.

Types of ResultSet in JDBC

ResultSet in JDBC can be of 3 types and can be defined while creation of the Statement
1. TYPE_FORWARD_ONLY – Default
2. TYPE_SCROLL_SENSITIVE – Created using ResultSet.TYPE_SCROLL_SENSITIVE
3. TYPE_SCROLL_INSENSITIVE – Created using ResultSet.TYPE_SCROLL_INSENSITIVE

How to create ResultSet

Get More details – Here

Use of ResultSet in JDBC

1. To Select and retrieve data from database
Please go through the below links for sample codes
a. Select records using Prepared Statement
b. Select records using Statement

2. Update/Insert records that were retrived from database.
For updating or inserting data using a resultSet, you need to have the ResulSet as UPDATABLE
This is how we can make a ResultSet updatable

Please go through the below links for sample codes
a. Insert Record using ResultSet
b. Update Record using ResultSet

Reference

ResultSet API

It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn