• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

JDBC - ResultSet- Pls help  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi....
I need the following information on ResultSet very urgently. can someone pls help me or let me know where can I get this info?
1). We can use SetFetchsize() to datasize to be retrieved from Result Set at one shot. When we use SetFetchSize(1024) and the there are only 10 records in ResultSet, what is the impact?
2). If we use the following to set the FetchSize equal to the number of rows and bring back cursor for fetching in normal, any impact on time?
rs.last()
nRows=rs.getRow();
rs.setFetchSize(nRows);
rs.beforeFirst();
while(rs.next())
{
....
}
3). If we set FETCH_FORWARDONLY, any gain in the execution speed
4). Any other features in JDBC2.0 that can improve performance?
5). Setting FetchSize same as RowCount(select count(*) from table), is it optimal?
also if u know any web sites or books I can refer to this pls pls let me know...
Thanx in advance!
Regards,
Gayathri.
 
gayathri sundarachar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone pls give some info on this...pls!
Any books to refer or any site??
I searched on web...didnt get any info on this.
any help would be very great help!
Regards,
Gayathri.
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
From my understanding of concepts, i'll try to give the answers to your questions.
1. There is no impact, if actual values are less than the "size" which was set.
2. This way you can't set the size, and will fail for 'TYPE_FORWARD_ONLY'. Refer JDK API.
3. Definitly yes, but it is default, so no need to set explicit.
4. No idea !
5. Definitly NOT ... why additional query ? count(*) is as costly as retrieving all the values ...
Cheers
Murthy
 
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you use Oracle then there is a great book by O'reilly "Java Programming with Oracle JDBC" by Donald Bales.
Even without Oracle you can get alot out of this book.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!