out of memory

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);
ObjetoDAO dao = new ObjetoDAO();
JCO.Function function = null;
JCO.Table codes = null;
try {
     function = this.createFunction("ZPMF_DATOSPM", mRepository);
     if (function == null) {
         System.out.println("ZPMF_DATOSPM" + " not found in SAP.");
                JCO.ParameterList input = function.getImportParameterList();
                codes = function.getTableParameterList().getTable("T_DATOSPM");
                for (int i = 0; i < codes.getNumRows(); i++) {
                      EQUNR = codes.getString("EQUNR");
                 String sql="insert into INFORME_MTO values('"+ EQUNR +"'')";      

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?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

u can either increase the nmemory size or u can alternatively have preparedstatements for the insert statement.
Mayank SAssociate Director - Product EngineeringCommented:
Use the -Xmx option to increase the heap-size in Java.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

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

Thank You.
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?
Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
mayankeagle i am sorry i didn't see your comment.

olgavillamizarAuthor Commented:
I use it but doesnt work
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.