Blob interface

The Blob interface represents (maps) an SQL BLOB in the Java(TM) programming language. An SQL BLOB is a built-in type that stores a binary large object as a column value in a row of a database table. A BLOB object is valid for the duration of the transaction in which it was created.

Methods in the interfaces ResultSet and PreparedStatement, such as getBlob and setBlob allow a programmer to access the SQL BLOB. The Blob interface provides methods for getting the length of an SQL BLOB (binary large object) value and for materializing a BLOB value on the client.

java.sql package

public interface Blob

Table 96 lists the methods in the Blob interface that are supported by DB2 Everyplace.

Table 96. Blob interface methods

Method return value type Method
InputStream getBinaryStream() Retrieves the BLOB designated by this BLOB instance as a stream.
byte[] getBytes(long pos, int length) Returns as an array of bytes part or all of the BLOB value that this BLOB object designates.
long length() Returns the number of bytes in the BLOB value designated by this BLOB object.

Related tasks

Related reference