Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accesing ResultSet

 
seetarama raju
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've a scenario where i've to pass same resultset
to two methods. Iam thinking of following two options
1) once the first one is done, call beforefirst
on resultset, so that it can start all over again
2)close the statement,and create a new statement
and execute query again and use the fresh resultset
Please let me know which has less performance
bottleneck
Thanks
 
Joe Nguyen
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you need to update field in the resultset on the fly. If it is a read only, there are overhead in both options
1. You need to maintain the connection during the interval of method execution.
2. There are overhead to create a rollable resultset
3. Query same resultset twice
Why don't you use disconnected resultset? Use HashMap to represent a record and ArrayList to represent resultset.
 
danny liu
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The first one is of performance benefit.
To create or release a connection costs a lot.
Dan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic