File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "JDBC" Watch "JDBC" New topic


Aruna Kolla

Joined: Jan 31, 2002
Posts: 2
I am using Oracle 8.1.6 and accessing it through JDBC driver using Java program.
In application code, I retrieve 2.5 million records. While looping through the result set, I make three more queries to the database using prepared statements. When I run my application, I get following error
Outofmemory oracle.jdbc.ttc7.TTCItem.
I tuned JVM and set its maximum heapsize to 500 MB and ran the application again. But still I have the same problem. Any ideas how I can resolve the problem?? Is there any way to solve this problem without depending on JVM heapsize?
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

are you storing this resultset to an arrayList or Vector or something!!??? Something in your program keeps on growing without the gc able to do its job. Do you close all your subsequent resultsets? Do you keep creating new objects in the loop of 2.5 million rows?
I don't know where to start. If the code isn't too overwhelming, maybe you could post it.
Aruna Kolla

Joined: Jan 31, 2002
Posts: 2
The main loop of the code is as follows :
while( // 2.5 million rows loop
Customer custObj = new Customer();
Hashtable attr_name_values = custObj.getAttributesBuffer();
Enumeration xmlnames=primary_info_ht.keys();
column_key =(String)xmlnames.nextElement();
if(attr_value != null)
attr_name_values.put(attr_name, attr_value);
1. Executes first prepared statement and closes the result set.
2. Executes second prepared statement and closes the result set.
3. Executes third prepared statement and closes the result set.
custObj.generateXML(fos); // This function uses a string buffer creates valid xml elements for a customer and prints to a file (not using dom or sax)
attr_name_values = null;
custObj = null;
All prepared statements are created before looping through the main result set.
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at .
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please re-register and select a new name which meets the requirements.
I agree. Here's the link:
subject: JDBC
It's not a secret anymore!