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 678539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:09:39+00:00 2026-05-14T01:09:39+00:00

hello fellow java developers. I’m having a bit of an issue here. I have

  • 0

hello fellow java developers.

I’m having a bit of an issue here. I have code that gets a resultset from an oracle database, prints each row to a file, then gets the next row – and continues till the end of the resultset.

Only this isn’t what happens. What happens is that it gets the resultset, starts iterating through the rows, printing to file as it goes, until it runs out of memory – claiming it needs more space on the java heap.

The app is currently running with 2g of memory on the heap and the code breaks at about the 150000th row.

I’m using jodbc6.jar and java 6

Here is an idea of what my code is doing:

Connection conn = DriverManager.getConnection(url,"name","pwd");

conn.setAutoCommit(false);
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery(strSql);

String strVar_1 = null;

long lCount = 0;
while(rset.next()){
        lCount++;
        if (lCount % 100000 == 0){
            System.out.println(lCount + " rows completed");
        }
      strVar_1 = rset.getString("StringID");  /// breaks here!!!!!!!!!

      if (strVar_1 == null){
        strVar_1 = "";
      }         
      if (!strQuery_1.equals("")){
        out.write(strVar_1 + "\n");
      }
 }
 out.close();
  • 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-14T01:09:39+00:00Added an answer on May 14, 2026 at 1:09 am

    Try below:

    Statement stmt = conn.createStatement();
    stmt.setFetchSize(someInt);
    ResultSet rset = stmt.executeQuery(strSql);
    

    This will control how many records are fetched at a time.

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

Sidebar

Related Questions

hello fellow java developers. I'm having a very strange issue. I'm trying to read
Hello fellow programmers, I have made a function that looks up the database if
Hello fellow developers. I have previously made a facebook fan page with an iframe
Hello fellow developers! I am trying to get the build error codes from a
Hello fellow programmers. I have a SQL Server 2005 query that is taking a
Hello Fellow stackoverflowers, I´m stuck writing a piece of code. I have application with
Hello fellow earthlings, I have an image as my background that I created in
Hello Fellow C# and Windows phone developers, For my windows phone application, I have
Hello fellow StackOverflowers! I have some information in a database that I need pulled
Hello fellow stackoverflow members! I'm very new to the C# language transfer from Java,

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.