File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBCRowSet (Scrollable or not)

 
Simon Joseph Aquilina
Ranch Hand
Posts: 102
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1557
5
Eclipse IDE Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Simon Joseph Aquilina
Ranch Hand
Posts: 102
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic