- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
SerialBlob
BLOB
value. 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. By default, drivers implement Blob
using an SQL locator(BLOB)
, which means that a Blob
object contains a logical pointer to the SQL BLOB
data rather than the data itself. A Blob
object is valid for the duration of the transaction in which is was created. Methods in the interfaces ResultSet
, CallableStatement
, and PreparedStatement
, such as getBlob
and setBlob
allow a programmer to access an SQL BLOB
value. The Blob
interface provides methods for getting the length of an SQL BLOB
(Binary Large Object) value, for materializing a BLOB
value on the client, and for determining the position of a pattern of bytes within a BLOB
value. In addition, this interface has methods for updating a BLOB
value.
To release resources used by the Blob
object, applications must call either the free()
or the close()
method. Any attempt to invoke a method other than free()
or close()
after the Blob
object has been closed, will result in a SQLException
being thrown.
All methods on the Blob
interface must be fully implemented if the JDBC driver supports the data type.
- Since:
- 1.2
Methods
- +Only in: JDBC 4.5; not in: JDBC 4.4.public default void close() throws java.sql.SQLExceptionNot in JDBC 4.4; only in JDBC 4.5
close
Closes and releases the resources held by thisBlobobject.If the
Blobobject is already closed, then invoking this method has no effect.- Specified by:
closein interfaceAutoCloseable- Implementation Requirements:
- The default implementation calls the
free()method. - Throws:
SQLException- if an error occurs releasing the Blob's resourcesSQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 26
- See Also:
- ≠public abstract void free() throws java.sql.SQLExceptionComparing JDBC 4.4 and JDBC 4.5
free
This method frees theBlobobject Closes and releases the resources that it holds. The object is invalid once thefreemethod is called. held by thisBlobobject.If the
Blobobject is already closed, then invoking this method has no effect Afterfreehas been called, any attempt to invoke a method other thanfreewill result in anSQLExceptionbeing thrown. Iffreeis called multiple times, the subsequent calls tofreeare treated as a no-op.- Throws:
SQLException- if an error occurs releasing the Blob's resourcesSQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
- See Also:
- =public abstract java.io.InputStream getBinaryStream() throws java.sql.SQLException
- =public abstract java.io.InputStream getBinaryStream(long arg0, long arg1) throws java.sql.SQLException
- =public abstract byte[] getBytes(long arg0, int arg1) throws java.sql.SQLException
- =public abstract long length() throws java.sql.SQLException
- =public abstract long position(byte[] arg0, long arg1) throws java.sql.SQLException
- =public abstract long position(java.sql.Blob arg0, long arg1) throws java.sql.SQLException
- =public abstract java.io.OutputStream setBinaryStream(long arg0) throws java.sql.SQLException
- =public abstract int setBytes(long arg0, byte[] arg1) throws java.sql.SQLException
- =public abstract int setBytes(long arg0, byte[] arg1, int arg2, int arg3) throws java.sql.SQLException
- =public abstract void truncate(long arg0) throws java.sql.SQLException
Summary
| Elements | Comments | Descriptions | Total | |||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Added | Changed | Removed | Added | Changed | Removed | Added | Changed | Removed | ||
| Blob | 2 | 14 | 16 | |||||||
| close() | 1 | 1 | 2 | |||||||
| free() | 6 | 2 | 2 | 10 | ||||||
| Total | 1 | 2 | 21 | 2 | 2 | 28 | ||||