posted 22 years ago
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