question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Java heap space error when writing > 2 GB file content as Blob into Oracle Table

See original GitHub issue

I have scenario to read a remote file of >2 GB file into an Oracle Blob Column. When ever the remote file size is > 1.2 GB I am am getting Java heap space error.

Below is my implementation? Can you please help?

object FileDownload: Table("FILE_DOWNLOAD") {
      private val fileID = integer("FILE_ID")
     val fileContent = blob("FILE_CONTENT")
}

val inStream = sftp.get(filePath)

transaction(db) {
    FileDownload.insert {
        it[fileContent] = ExposedBlob(inStream.readBytes())
    }
    inStream.close()
}

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Tapaccommented, Nov 12, 2022

It might become better with the next release. Now ExposedBlob stores inputStream by default, so please wait for the release and check will it helps or not. Don’t forget to replace ExposedBlob(inStream.readBytes()) with ExposedBlob(inStream)

0reactions
harinivas-ganapathycommented, Dec 6, 2022

But I was able to write the entire 5GB of data back into another local file from inStream

Read more comments on GitHub >

github_iconTop Results From Across the Web

Java Heap Space Error while inserting large file. — oracle-tech
My code breaks if I try to insert a file bigger then couple of MBs (I would say more then 10 MBs) The...
Read more >
Java Heap Space Exception, with big ammount of data, any ...
The aplication is throwing java heap exception, the memory consumption is raising over 600m and the CPU usage over 50% until the exeption....
Read more >
Java heap space" error in AWS Glue
The "java.lang.OutOfMemoryError: Java heap space" error indicates that a driver or executor process is running out of memory. To determine ...
Read more >
Downloading/Streaming Content with ORDS (File Downloads!)
One, that the content type for the data is variable – in this case I'm storing it as a column in the table,...
Read more >
SQL-Developer: How to prevent the “Java Heap Space” error
When you are working with a lot of worksheets and reports or try to open large SQL files, you may run into “Java...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found