File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes OutOfMemoryError while executing a Callable Statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "OutOfMemoryError while executing a Callable Statement" Watch "OutOfMemoryError while executing a Callable Statement" New topic

OutOfMemoryError while executing a Callable Statement

Jiggi Piggi

Joined: Jun 30, 2009
Posts: 3
Hi guys...please help me solve this error..I tried everything i could but all in vain...

In the code I wrote, first i set up a JDBC connection. Then I read contents of an excel sheet (using JExcel API). Then I call an oracle procedure (using CallableStatement) which has return parameters. This call to procedure is once for each row in the excel. Then I write the out parameters in another excel.

But the program is not able to process more than 150 rows.

here is what i get:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at oracle.jdbc.driver.T4CCallableStatement.doOall8(
at oracle.jdbc.driver.T4CCallableStatement.execute_for_rows(
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(
at oracle.jdbc.driver.OracleCallableStatement.executeUpdate(

I even increased the heap space. Please help me out. Thanks in advance.

ujjwal soni
Ranch Hand

Joined: Mar 28, 2007
Posts: 403

Can you post some code please ?

Are you closing your connection, statement and resultset in finally clause ?

Ujjwal B Soni <baroda, gujarat, india> <+918866008962>
"Helping hands are better than praying lips......"
Jhakda Velu
Ranch Hand

Joined: Feb 26, 2008
Posts: 167
How big is your input file? Can we call your procedure in one go rather than one by one? If you input file is too big, try reading the necessary contents and closing it. Post code if you are allowed to.


If I become filthy rich, I'll sponsor research for painless dental treatment at Harvard Medical School. Thats why,I'm learning Java.I have 32 teeth, 22 are man made.
Jiggi Piggi

Joined: Jun 30, 2009
Posts: 3
Hello guys...thanks for your reply...

I found the mistake....i had put the callable statement's declaration in a loop....just becaust the code was too big, i couldnt find it...

thanks again

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33127

Thanks for sharing the solution.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: OutOfMemoryError while executing a Callable Statement
It's not a secret anymore!