• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Populating the cachedRowSet

 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am facing the following problem.
I execute a query, which is large and complex, it takes a 4 to 5 seconds to execute and returns around 20 rows. But while populating the cachedrowset, takes more than the time it takes to execute the query. The database is Oracle 9i.



It will be great if anybody has experiences similar problem before or knows what is going on here. Any inputs are greatly appreciated.

Many Thanks
Anupreet
 
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here are a few things to check:

1. Can you eliminate some columns or rows from your result set?
2. Call Statement.setFetchSize() before running the query.
3. Set the result set type on your statement to ResultSet.TYPE_FORWARD_ONLY.
4. Have your network engineer check for network congestion that may be slowing down retrieving the data.

I'm not an Oracle expert, but it could be that the JDBC driver is returning from the execute() method as soon as one or more rows is available for the result set. Oracle continues to run the query and generate results in the background. You are calling cachedRowSet.populate() which tries to read all of the rows, but they aren't all available yet so populate() waits for rest of the results.

You could test this theory by running the sql in sqlplus. If it's true, it will take about 15-20 seconds to return all rows.
 
Anupreet Arora
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the response Scott.

Have tried a number of things. Changing the database shared_pool_size and cursor_space_for_time parameters seem to be helping the most here.
 
reply
    Bookmark Topic Watch Topic
  • New Topic