• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Retrieving Results from Oracle

 
Rehan Malik
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having an OutOfMemory exception being thrown because the Vector cannot store all the information that I am retrieving.
Here's what is known:
There are 99,000 rows being returned with 8 columns of data being retrieved from the database.
The memory appears to be jumping quite rapidly if I try to retrieve the 99,000 rows of results. Is there any possible way I can minimize the memory usage and still retrieve all the results?
Any suggestions? Here is the code below which does the retrieval of information:
</pre>
public Vector getRowInfo(ResultSetMetaData rsmd, ResultSet rs)
throws SQLException
{
Vector vRow = new Vector();
Vector vRowElements = new Vector();
while(rs.next())
{
vRowElements.clear();
for(int i = 1; i <= rsmd.getColumnCount(); i++)
{
vRowElements.addElement(rs.getString(i));
}
vRow.addElement(vRowElements);
}
return vRow;
}
</pre>
Thanks
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://java.sun.com/j2se/1.3/docs/api/java/util/ArrayList.html
using an arraylist is the same as a vector except it is not synchronized which will save you some overhead. If you are retrieving 99000 rows and 8 columns per row, I think you need to get more memory! Do you need all 99000 rows at once in your vector?
Jamie
 
Rehan Malik
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I just found a better way of handling what I needed to do.
I was using a Vector to hold all the information and then pulling information from the same vector and gonna throw all the data into a JTable. Ill just throw it directly into the JTable instead of putting it into the vector over and over.
Thanks neways.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic