posted 22 years ago
Hi,
When I use
ResultSet rs = stmt.executeQuery("Select * from ..."); I retrieve a ResultSet which contains many records (say 10000). Subsequently I loop on the ResultSet and load a Vector with data extract from ResultSet. In particular i nested two loop like in example below:
Vector result = new Vector();
ResultSetMetaData rsm = rs.getMetaData();
while(rs.next){
result.add(rs.getString(1));
...
for(j=x;j<rsm.getColumnCount();j++){>
if (rsm.getColumnType.equals("CHAR")){
.....
result.add(rs.getString(j));
}
else{
.....
result.add(rs.getBigDecimal(j));
}
}
}
The performance of this loop is very low and in many case the application crash.
My question is, how can I handle these kinds of huge resultsets and how can improve the application performance.
Note:
I have noticed that my DBMS (Oracle 8) execute the query in few millisecond.
Regards,
Antonio S.