ho un problema con la memoria di JVM in quanto prendere delle righe da database ed ed inserirle in un una nuova tabella.
Allore prendo le righe e le salvo in un oggetto di tipo ResultSet soltanto che siccome ho un milione di righe mi da errore di Out of Memory.

Come posso risolvere questo problema

Il codice è il seguente:

codice:
int f=0;    
        String query=new String("select tp,usec,target from featuresTable limit "+f+",100000;");
        ResultSet rs=cn.query(query);
        while(rs!=null){
        rs.beforeFirst();
            while(rs.next()){    
                String query1=new String("insert into DataSetFromFeatures(TP,usec,target) values('"+rs.getDate(1)+"','"+rs.getInt(2)+"','"+rs.getString(3)+"');");
                cn.update(query1);
                }
        f=f+100000;
        query="select tp,usec,target from featuresTable limit "+f+",100000;";
        rs=cn.query(query);
        }
Grazie