aspose file tools*
The moose likes JDBC and the fly likes Scrollable result set cached by driver? 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 » Databases » JDBC
Bookmark "Scrollable result set cached by driver?" Watch "Scrollable result set cached by driver?" New topic
Author

Scrollable result set cached by driver?

D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 472

Recently we found a problem that Oracle JDBC driver simulates scrolling operations in result set by caching entire result in memory. Certainly it rises a problem for multi million result. How do you resolve problem of:
1. getting number of record in result set?
2. scrolling to first shown record?

Is rs.next() perform well, or some other trick like including max(rownum) in a query will work better?


Retire your iPod and start with HD Android music player Kamerton | Minimal J2EE container is here | Light weight full J2EE stack | and build tool | Co-author of "Windows programming in Turbo Pascal"
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30758
    
156

Originally posted by D Rog:
Is rs.next() perform well, or some other trick like including max(rownum) in a query will work better?

rs.next() is inefficient if all you need is the count. rs.next() results in a lot of network traffic and extra work that is not required to get the count.

Also, select count(*) from .... is more efficient than max(rownum)


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Scrollable result set cached by driver?