Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

get part of ResultSet from a large table

 
ZhiningZhang
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hello, All,
Get ResultSet from "select * from mytable". But my talbe is too huge, I got error message (java.lang.OutOfMemoryError <<no stack trace available>>) .
Can I get ResultSet 100 rows each time? Is there any jdbc example for this solution?
" Select top 100 * from mytable " only gives me top 100, how can I get next 100 rows ???
Thanks! -Zhining
 
ZhiningZhang
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

how to use FetchSize in ResultSet? Can FetchSize solve my problem ?
Thanks! -Zhining
 
Anil Kumarknr
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use stmt.setFetchSize(100). It will pick 100 records from the table each time.
 
rani bedi
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What should I do if I want to access the next 100 records after fetching the 100 records?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic