Knowledge Base
Published Jun. 30, 2025

How to handle "Connection Closed" Error with BLOB Type in Oracle DB?

Written By

Sebastian Madaras

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Issue

  • A "Connection closed" error occurs when handling BLOB type columns in Oracle databases using the getBinaryStream() method in Java, a known issue when attempting to read BLOB data in chunks after the database connection has been closed.

Environment

  • All Liferay DXP versions that use Oracle 

Resolution

  • This behavior is primarily specific to Oracle databases due to the way Oracle handles BLOB data retrieval and streaming.
  • To prevent the "Connection closed" error, use the ResultSet::getBytes() method to read the entire BLOB data at once, and convert it into an InputStream using ByteArrayInputStream if needed for stream-based processing. 

Additional Information

Did this article resolve your issue ?

Knowledge Base