The representation (mapping) in the Java
TM programming language of an SQL
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 {@link java.sql.ResultSet}, {@link java.sql.CallableStatement}, and {@link java.sql.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.
All methods on the Blob
interface must be fully implemented if the JDBC driver supports the data type.
HSQLDB-Specific Information:
Previous to 2.0, the HSQLDB driver did not implement Blob using an SQL locator(BLOB). That is, an HSQLDB Blob object did not contain a logical pointer to SQL BLOB data; rather it directly contained a representation of the data (a byte array). As a result, an HSQLDB Blob object was itself valid beyond the duration of the transaction in which is was created, although it did not necessarily represent a corresponding value on the database. Also, the interface methods for updating a BLOB value were unsupported, with the exception of the truncate method, in that it could be used to truncate the local value.
Starting with 2.0, the HSQLDB driver fully supports both local and remote SQL BLOB data implementations, meaning that an HSQLDB Blob object may contain a logical pointer to remote SQL BLOB data (see {@link JDBCBlobClient JDBCBlobClient}) or it may directly contain a local representation of the data (as implemented in this class). In particular, when the product is built under JDK 1.6+ and the Blob instance is constructed as a result of calling JDBCConnection.createBlob(), then the resulting Blob instance is initially disconnected (is not bound to the tranaction scope of the vending Connection object), the data is contained directly and all interface methods for updating the BLOB value are supported for local use until the first invocation of free(); otherwise, an HSQLDB Blob's implementation is determined at runtime by the driver, it is typically not valid beyond the duration of the transaction in which is was created, and there no standard way to query whether it represents a local or remote value.
@author james house jhouse@part.net
@author boucherb@users
@version 2.0
@since JDK 1.2, HSQLDB 1.7.2
@revised JDK 1.6, HSQLDB 2.0