File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Scrollable ResultSet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Scrollable ResultSet" Watch "Scrollable ResultSet" New topic

Scrollable ResultSet

A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 980
Hi all,

In real time much use of scrollable resultsets is made..

Any scenario where we have to go for scrollable sets than non scrollable resultsets..

Thanks & Regards
Maximilian Xavier Stocker
Ranch Hand

Joined: Sep 20, 2005
Posts: 381
Originally posted by A Kumar:
Hi all,
In real time much use of scrollable resultsets is made..

Hard question to answer definitively but I would say very little. I couldn't remember the last time I used a scrollable result set in anything (either JDBC or ODBC or ADO), years anyway.

Often for well designed code I would say they are not required. One of the major uses appears to be people looking for row counts but that's not really a very good use of them.

I think largely if you really must have a scrolling result you are probably better off with a CachedRowSet anyway.

But as I said these aren't really hard and fast rules, in my opinion though there isn't much use for them.
A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 980
Thanks Xavier..

So we can use the non-scrollable ..ones for our work..
rarely needing the scrollable resultsets

stu derby
Ranch Hand

Joined: Dec 15, 2005
Posts: 333
I second the previous post.

In addition, this is in part because in at least some of the major database, scrolling result sets either don't perform particularly efficiently, or because the entire result set gets cached by the driver in memory, or both.

In other words, they're best used for small results, and for small results is often easier to use a non-scrollable anyway and convert each row to a Java object; there's just not that much benefit.

In the long run, if DB vendors and driver writers improve the driver implementations substantially, scrollables could be a lot more usable...

It's certainly possible to use them in a limited way, and I suppose there may be a driver implementation out there that works well, but it's not something I'd generally recommend to beginners (if they'd listen to me); you have to know a lot about how the underlying implementation is really doing things, or restrict yourself to toy or small-scale projects.
I agree. Here's the link:
subject: Scrollable ResultSet
It's not a secret anymore!