setBinaryStream(int parameterIndex, InputStream x, long length)


void setBinaryStream(int parameterIndex,
                     InputStream x,
                     long length)
                     throws SQLException


Sets the designated parameter to the given input stream, which will have the specified number of bytes. When a very large binary value is input to a LONGVARBINARY parameter, it may be more practical to send it via a object. The data will be read from the stream as needed until end-of-file is reached.

Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.



the first parameter is 1, the second is 2, ...


the java input stream which contains the binary parameter value


the number of bytes in the stream


SQLException - if a database access error occurs, parameterIndex is less than 1 or greater than the number of parameters, length is less than 0, or the prepared statement has been closed


For more information, reference JDBC documentation for: PreparedStatement.setBinaryStream(int, InputStream, long)