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

  • Home
  • SEARCH
  • 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 930235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:18:06+00:00 2026-05-15T20:18:06+00:00

Currently I am using statement.executeQuery(qStr) in java to select a large amount of data

  • 0

Currently I am using statement.executeQuery(qStr) in java to select a large amount of data from mysql. Unfortunatly, java keeps running out of memory at the statement.executeQuery(qStr) statement with exception java.lang.OutOfMemoryError: Java heap space. I am wondering if there is a method to stream load data from mysql. So that I can handle the selected data trunk by trunk to avoid running out of memory?

Note that: I am using eclipse and this post shows me how to increase the heap memory for java to use inside eclipse. But after I followed it’s method, i am still running into the same problem.

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-05-15T20:18:07+00:00Added an answer on May 15, 2026 at 8:18 pm

    Yes, you can set the FetchSize on a Statement to Integer.MIN_VALUE , the ResultSet should be
    TYPE_FORWARD_ONLY as well, though I believe that’s the default.. MySQL treats that specially and enables streaming of the ResultSet instead of reading it all into memory, it’s documented here

    PreparedStatement stmt =  
     conn.prepareStatement(sql,ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_READ_ONLY);
    stmt.setFetchSize(Integer.MIN_VALUE);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 491k
  • Answers 491k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Consider encryption and encoding as two distinct and unrelated steps.… May 16, 2026 at 10:10 am
  • Editorial Team
    Editorial Team added an answer If it is a single file, the easiest way would… May 16, 2026 at 10:10 am
  • Editorial Team
    Editorial Team added an answer You can use the Date.strptime method to read a date… May 16, 2026 at 10:10 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I am wanting to insert a datetime into a MySql data base using Java
I am currently using this process to Sanitize/Filter comment entered by users -> This
I am currently using Watir with Firefox and it seems that when I try
I'm currently using the automatic mipmap generation (C# + OpenTK): GL.GenerateMipmap(GenerateMipmapTarget.Texture2D); The texture I'm
I'm currently using JCarousel to highlight featured posts in Wordpress. The carousel displays above
I'm currently using the jquery-form-observe plugin which uses onbeforeunload to prompt the user about
I have to improve some code where an Oracle stored procedure is called from
hello fellow java developers. I'm having a bit of an issue here. I have
I am using Cache in a web service method like this: var pblDataList =
I was always using JDBC in JavaSE on single-threaded environment. But now I need

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.