out of memory

Hi!
I´m trying to take some information from a sap table and then saving it into a sql table.
I use Jco Java connector to do this..

public void makeIn(String ubicacionTecnica) {
         
Client mConnection = this.getManualConnection();
Repository mRepository = this.getRepository(mConnection);
mConnection.connect();
ObjetoDAO dao = new ObjetoDAO();
         
JCO.Function function = null;
JCO.Table codes = null;
try {
               
     dao.eliminarInformeMTO();
     function = this.createFunction("ZPMF_DATOSPM", mRepository);
     if (function == null) {
         System.out.println("ZPMF_DATOSPM" + " not found in SAP.");
         System.exit(1);
     }
     
                JCO.ParameterList input = function.getImportParameterList();
                input.setValue(ubicacionTecnica,"UBIC_TEC");
     mConnection.execute(function);        
   
                codes = function.getTableParameterList().getTable("T_DATOSPM");
                for (int i = 0; i < codes.getNumRows(); i++) {
                      codes.setRow(i);
                      EQUNR = codes.getString("EQUNR");
           
                 String sql="insert into INFORME_MTO values('"+ EQUNR +"'')";      
     dao.ingresarDatos(sql);
}

When the code is running I get an error when I try to do the for becouse the original table has aprox 128.000 data and the error is out of memory.

Someone know what I have to do?

Thanks
LVL 1
olgavillamizarAsked:
Who is Participating?
 
Mayank SAssociate Director - Product EngineeringCommented:
Use the -Xmx option to increase the heap-size in Java.
0
 
gauravkrtomarCommented:
u can either increase the nmemory size or u can alternatively have preparedstatements for the insert statement.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
olgavillamizarAuthor Commented:
I Use java -XX:+AggressiveHeap  but I have the same problem
0
 
Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
try -Xmx option by specifying the Heap size suitably my trail & error method.

Thank You.
0
 
Mayank SAssociate Director - Product EngineeringCommented:
That's what I suggested: >> Use the -Xmx option to increase the heap-size in Java.

Did you try it?
0
 
Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
mayankeagle i am sorry i didn't see your comment.

:-)
0
 
olgavillamizarAuthor Commented:
I use it but doesnt work
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.