Error "ORA-17068: Invalid argument(s) in call" Using Method setBinaryStream(0L) in JDBC 11.2.0.1 (Doc ID 1234235.1)

Last updated on AUGUST 03, 2016

Applies to:

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

Symptoms

Position 0 is being used in the JDBC Lob functions.  For example, in below code setBinaryStream(0) is getting the OutputStream starting at position 0 from a java.sql.Blob.

OutputStream outputStream;
byte[] mybytes = {1,2,3,4,5,6,7,8,9,10};
PreparedStatement pstmt = pconnection.prepareStatement("select blobke from testblob for update");
ResultSet rset = pstmt.executeQuery();
while (rset.next())
{ Blob blob = rset.getBlob(1);
  outputStream = blob.setBinaryStream(0L);
  outputStream.write(mybytes);
  outputStream.flush();
  outputStream.close();
}


This code results in the following error:
ORA-17068: Invalid argument(s) in call

An example stack trace:
java.sql.SQLException: Invalid argument(s) in call
at oracle.jdbc.driver.T4CConnection.newOutputStream(T4CConnection.java:2753)
at oracle.sql.BLOB.setBinaryStream(BLOB.java:893)

Changes

upgrade of Oracle JDBC driver to 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