Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8949011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:08:21+00:00 2026-06-15T13:08:21+00:00

I need to fetch 2 million records from the oracle database(1 year data). When

  • 0

I need to fetch 2 million records from the oracle database(1 year data).
When I am retrieving it as list, it is taking ‘n’ minutes and it hangs.

sqlMap.queryForList("getResultSet", parameterMap);

So, I tried implementing IBatis "RowHandler" interface and I overrided the "handleRow(Object obj)" and I am able to get the result (One row at a time).

But I need to get ‘n’ rows at a time where n >= 1000. So I added fetchSize="1000" and resultSetType="FORWARD_ONLY" attribute to my select statement.

E.g:

<select id='getResultSet' parameterClass='java.util.Map' fetchSize="1000" resultSetType="FORWARD_ONLY">  

But still I am getting only one row at a time in the "handleRow(Object obj)" method.

@Override
public void handleRow(Object queryResult) {     

        if(queryResult != null) {

            try {

                tempResultMap = (ClassName) queryResult;
                resultList.add(tempResultMap);
                System.out.println("List Size -> " + reportList.size());
            } catch (Exception e) {
                e.printStackTrace();
            }       
        }   
    }  

When the method is called during query execution, "List Size ->" is always incrementing by one. But I am expecting increment rate of 1000 (As I have given fetchSize = “1000”)…

When I googled out, there is a property available(Driver.useCursorFetch) which can be used along with "fetchSize" and "resultSetType".
Reference : http://www.yaldex.com/mysql_manual/ch23s04.html or Ibatis queryWithRowHandler() still seems to fetch all rows.
But I think it is only for MySQL Database.
What is the equivalent property(Driver.useCursorFetch) for Oracle 11g database.
I need some configuration like below.

<bean id="sourceName" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />                         
    <property name="url" value="jdbc:oracle:thin:@host:port:sid" />
    <property name="username" value="$uname" />
    <property name="password" value="$pwd" />
    <!-- 
    Some thing like this 
    <property name="configName(Instead of Driver.useCursorFetch)" value="true/false" />
    -->

</bean>

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T13:08:23+00:00Added an answer on June 15, 2026 at 1:08 pm

    handleRow only gives you a single row. Using fetchSize, you should be able to delete your handleRow method, if I understand your scenario correctly.

    If you really do need to handle each rown individually, you can make a stateful (non-singleton) RowHandler with a private list and implements the Observer pattern, notifying listeners each time you’ve hit 1000 records.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say I need to fetch some records from the database, and filter them
I need to fetch data from database for backup in the form of insert
I need to fetch data from normalized MSSQL db and feed them in Solr
Im using vb.net and I need to fetch data from two different tables and
I need to fetch images and some other data from server and then display
I need to fetch data from nested Dictionary IN C# . My Dictionary is
I need to fetch data from a URL with non-ascii characters but urllib2.urlopen refuses
I need to fetch records within interval of an year in cakephp. I tried
I need to fetch scope_identity() value from a stored procedure after inserting data in
Need to fetch data from a few tables -table one has all product details

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.