aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes JDBCRowSet (Scrollable or not) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "JDBCRowSet (Scrollable or not)" Watch "JDBCRowSet (Scrollable or not)" New topic
Author

JDBCRowSet (Scrollable or not)

Simon Joseph Aquilina
Ranch Hand

Joined: Feb 14, 2006
Posts: 102
Hello,

I am reading Java Tutorials - JDBC. Here I read that JDBC RowSet objects "Add Scrollability and Updatability".
However when I read about JDBCRowSetImp I find the following: "The ResultSet object that is passed to the JDBCRowSetImpl constructor must be scrollable" and "if you have run the method createStatement [yo create a ResultSet] without any arguments (ResultSet.TYPE_SCROLL_SENSITIVE), the ResultSet would not be scrollable and neither would the JDBCRowSet".

So my question is; In what case will a JDBCRowSet Add Scrollability?
Anayonkar Shivalkar
Bartender

Joined: Dec 08, 2010
Posts: 1509
    
    5

Hi Simon,

From documentation of java.sql.ResultSet:

In a scrollable ResultSet object, the cursor can be moved backwards and forwards, to an absolute position, or to a position relative to the current row.


By default the ResultSet object contains a cursor pointing to beginning and it moves forward only. Also, it can be iterated only once. Thus, to add more functionality (e.g. to move backwards, or to iterate it more than once), 'scrollable' comes into picture.

I hope this helps.


Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Simon Joseph Aquilina
Ranch Hand

Joined: Feb 14, 2006
Posts: 102
Anayonkar Shivalkar wrote:By default the ResultSet object contains a cursor pointing to beginning and it moves forward only. Also, it can be iterated only once. Thus, to add more functionality (e.g. to move backwards, or to iterate it more than once), 'scrollable' comes into picture.


However the book I am reading seems to be saying that JDBCRowSet will not be scrollable when the ResultSet it wraps is not also scrollable.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBCRowSet (Scrollable or not)