Silent (No Error) Truncation Reading a 4 GB or Larger BLOB with JDBC 11.2.0.1 (Doc ID 1101163.1)

Last updated on MARCH 08, 2017

Applies to:

JDBC - Version 11.2.0.1 to 11.2.0.1 [Release 11.2]
Information in this document applies to any platform.

Symptoms

A java application reads BLOBs from a database and writes them to a file using the code:

while (resultSet.next()) {
   File lf = new File("C:\\temp\\LARGEFILE.bin");
   FileOutputStream fos = new FileOutputStream(lf);
   byte[] buffer = new byte[1024];
   InputStream is = resultSet.getBlob(1).getBinaryStream();
   while (is.read(buffer) > 0) {
     fos.write(buffer);
   }
fos.close();
}

When using JDBC 11.2.0.1 to read a 4 GB or larger BLOB from an 11.1.0.6 database, the output is truncated. There is no error.

However, when using JDBC 11.1.0.7 to read the same 4 GB or larger BLOB, truncation does not occur.

When using JDBC 11.2.0.1 to read a 4 GB or larger BLOB from a 10.2.0.3 database instead of from an 11.1.0.6 database, an "ORA-22925: operation would exceed maximum size allowed for a LOB value" error occurs. See <<Note 1101087.1>> "ORA-22925: operation would exceed maximum size allowed for a LOB value" Reading a 3 GB BLOB with JDBC 11.2.0.1 for details.

Changes

The truncation occurred after upgrading JDBC 11.1.0.7 to JDBC 11.2.0.1.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms