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 Limiting 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 "Limiting ResultSet" Watch "Limiting ResultSet" New topic

Limiting ResultSet

kayanaat sidiqui
Ranch Hand

Joined: Sep 04, 2008
Posts: 122
Hi All,

I have more than 10 lakh records in database.

i need to fire a query to the database and
generate the xml by putting those data got form query.

Now what i wrote the program, throws heap memory error.

Now what i want to limit the size of result set.
like take only 50 lakh result in resultset, generate xml, then
go for next 50 lackh data in result set, generate xml and so on....

Is this possible?

Or any other but better way to do it?

Adinath Shirsath
Ranch Hand

Joined: Dec 04, 2007
Posts: 35
Try using scrollable resultset
kayanaat sidiqui
Ranch Hand

Joined: Sep 04, 2008
Posts: 122
Hi Adinath
Thank you for quick reply.
can you please tell me how to use scrollable resultset for my scenerio.

waiting for your prompt and sharp comment.

Arunkumar Subramaniam

Joined: Apr 08, 2009
Posts: 8

Already discussed , see this topic
I agree. Here's the link:
subject: Limiting ResultSet
It's not a secret anymore!