0

I am trying to use rs.first(), but for that to work we have to add ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY in preparedStatement, I just wanted to know whether it is advisable to use and it has any performance issues

PreparedStatement ps = conn.prepareStatement ("SELECT * FROM TABLE WHERE 
     FIELD1 = ?" ,
     ResultSet.TYPE_SCROLL_INSENSITIVE , 
     ResultSet.CONCUR_UPDATABLE ,
     ResultSet.HOLD_CURSOR_OVER_COMMIT) ;
smootherbug
  • 129
  • 12
  • Why do you need to use `rs.first()`? For almost all 'normal' uses of JDBC you don't need to use scrollable result sets, and using `rs.next()` will work just fine. And yes, they usually have negative implications for performance, but this really depends on the specific database and driver used. – Mark Rotteveel Jun 17 '19 at 07:15
  • @MarkRotteveel, I have to use the same resultset and traverse again, so I have to use rs.first() or there is some other way to do this, can you help ma regarding this. I am using oracle 11g and 12c. – smootherbug Jun 17 '19 at 09:19
  • But why do you need to do this? In any case if you really have to do this, then performance considerations aren't really important because you have to do it anyway. – Mark Rotteveel Jun 17 '19 at 09:23
  • @MarkRotteveel, my requirement is to use same resultset at two places so only i went for this, is there any other method to do this. – smootherbug Jun 17 '19 at 09:44

0 Answers0