JDBC ResultSet

How can you retrieve data from the ResultSet?

1. Create a ResultSet containing all data from my_tab
stmt = con.createStatement()
rs = stmt.executeQuery("SELECT * FROM my_tab")

2. Fetch each row from the ResultSet rs.next()
3. Get the data from the row using the column index
4. Get the data from the row using the column name

What are the various means of accessing results from ResultSet objects? Explain them.

Scrollable ResultSets
Scroll sensitivity
Updatable ResultSets.

Scrollable Resultsets
Scrolling resembles the moving the cursor in a set of rows. The ResultSets are scrollable by nature. The cursor can move through the ResultSet. The scrolling can be made in bidirectional fashion.

Scroll Sensitivity
JDBC API allows the cursor in a ResultSet to scrollable and in general sensitive to the modifications. The rows in the ResultSet scroll from the first row and up to the row which has the highest identification / number when the rows are requested. Using the static final member of ResultSet, TYPE_SCROLL_SENSITIVE.

Updatable Resultsets
JDBC API allows the result sets to be updated. To get the data to be updated in the concurrency mode the static final members CONCUR_UPDATABLE is used.

Explain the types of Scrollable Resultsets.


To make the cursor to move in the forward direction only in the specified ResultSet this static final member is used.

To make the cursor to move in the forward direction only and to make not sensitive for the changes which were done by others
What is a non-repeatable read?
JDBC Non-repeatable Read - A Non-repeatable read is where one transaction cannot read the second time unless another transaction alters the row...
List the advantages of JDBC
JDBC Advantages- Provide Existing Enterprise Data, Simplified Enterprise Development, Zero Configuration for Network Computers, Full Access to Metadata...
What will Class.forName do while loading drivers?
JDBC drivers - When you have loaded a driver, it is available for making a connection with a DBMS...
Post your comment