Forums Register Login

JDBC - ResultSet- Pls help

+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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.
I yam what I yam and that's all that I yam - the great philosopher Popeye. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 921 times.
Similar Threads
Fetchsize
time taken in rs.next()
Setting fetch size for fast retrieval of data
get part of ResultSet from a large table
getting ResultSet from Oracle procedure
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 05:40:51.