Subject Re[2]: [Firebird-Java] Re: getObject and blob
Author Marczisovszky Daniel

Maybe the solution would be the subtype. As I read here: Maybe BLOBs with subtype 2
should be treated as BLOB and subtype 0 and subtype1 should be treated
as BINARY. This means when a Blob is subtype 2 it should not accept
getBytes, setBytes, getString, setString and it should return a Blob

This is bit offtopic, but: when Sun introduced Blobs and Clobs in JDBC
2.1 they provided no way to update or a set a blob. There was only
getBinaryStream. The only way to change data in a Blob was
vendor-specific, you can not create a "Blob" object. Although JDBC 3.0
introduced new features for updating Blobs, I believe it suffers from
the same problem. Although the new API (with setBinaryStream and
setBytes)is much more useable when using updatable resultsets.

In my eyes this is the historic reason for which other JDBC drivers
does handle even the BLOB fields in the database as binary fields,
because this it is much convinient to create a byte[] or String object
rather than to create a FBBlobField, a PGSqlBlob or a Blob (in MySQL

One more little thought about the blob concept in JDBC:

JDBC API says about Blob:

* The representation (mapping) in the JavaTM 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. The driver implements 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.
* This class is new in the JDBC 2.0 API.

Actually I can't tell that I really understand why Sun created the
Blob interface, but I suppose it is a helper for those databases that
can operate on a BLOB field on the server with a LOCATOR object (like

Best wishes,