• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

RowSet over ResultSet - Need explanation

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I was reading through RowSet Objects in JDBC Tutorial & found that it is written as

Some DBMSs do not support result sets that can be scrolled (scrollable), and some do not support result sets that can be updated (updatable). If a driver for that DBMS does not add the ability to scroll or update result sets, you can use a RowSet object to do it.

So that means if we use RowSet Object, by default it is scrollable & updatable. But there is another statement written in

Using JDBCRowSet Objects

topic that -

A JdbcRowSet object created with a ResultSet object serves as a wrapper for the ResultSet object. Because the RowSet object rs is scrollable and updatable, jdbcRs is also scrollable and updatable. If you have run the method createStatement without any arguments, rs would not be scrollable or updatable, and neither would jdbcRs.



So now I am confused, in the above case RowSet is dependent on resultSet type. Then if some DBMS drive does not support scrollable RowSet object it will also not support jdbcRowSet object which is constructed like above. Can someone explain me this? Also can somebody tell me some example of DBMS which does not support scrollable resultSet ? What is actual usage of RowSet over ResultSet ?
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't have experience using RowSets, so I may be wrong, but I believe that if you want to ensure the updatability and scrollability regardless of the database capabilities, you need to use Default JdbcRowSet Objects, as described in that tutorial.

If you create the RowSet from an existing ResultSet, it won't add the special capabilities (I believe the fundamental reason is it is not possible to obtain the SQL query the resultset is based on).
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

My interpretation of the documentation was the same as Debs I think, but if I understand Martin correctly, then this would explain why trying to get scrollability (don't need updatability) from the results returned from an Oracle stored procedure won't work, because the Oracle CURSOR is 'forward only':-



Am I right about the CURSOR being at the root of the problem?

Can anyone offer any ideas for 'converting' the CURSOR to a scrollable resultSet?

Of course I can write some code to iterate through the resultSet and process it, but ideally I just want that resultSet scrollable. The code is from an application that queries sundry database sources by means of prepared statements, and then processes the results with a lot of proven, tried and tested code dependent upon scrollable resultSets. For various reasons it makes sense to use Oracle stored procedures for this datasource, I'll be able to reuse lots of code and integrate more easily if the data is scrollable.

Thanks for taking the time to read this far, any ideas and suggestions welcome
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic