JDBC Type 2 Driver Programmer's Reference for SQL/MX Release 3.2.1 (H06.26+, J06.15+)

When the row containing the BLOB column is deleted by the application, the corresponding BLOB
data is automatically deleted by the delete trigger associated with the base table. For information
about triggers, see “Using SQL/MX Triggers to Delete LOB Data (page 57).
See also “NULL and Empty BLOB or CLOB Value (page 52).
NULL and Empty BLOB or CLOB Value
The data locator can have a NULL value if the BLOB or CLOB column is omitted in the insert
statement. The JDBC/MX driver returns NULL when the application retrieves the value for such a
column.
When the application uses the EMPTY_BLOB() method or EMPTY_CLOB() method to insert
empty BLOB or CLOB data into the BLOB or CLOB column, JDBC/MX driver returns the Blob or
Clob object with no data.
Transactions Involving Blob and Clob Access
HP recommends that your JDBC applications control the transactions when the BLOB columns or
CLOB columns are accessed either by using the external transaction or by setting the connection
to manual commit mode.
If executing a prepared statement involving BLOB or CLOB data with autocommit mode enabled
and an external transaction does not exist, the JDBC/MX driver mimics autocommit mode. This
operation ensures that inserts or updates of LOB data are committed only after both the base table
and LOB tables are modified.
In some instances an outputStream or Writer object is returned to the application when the
object can be held for an unknown period of time. Therefore, the following interfaces throw the
exception, Autocommit is on and LOB objects are involved, exception when LOB
data is involved, autocommit is enabled, and an external transaction does not exist:
Clob.setAsciiStream
Clob.setCharacterStream
Blob.setBinaryStream
If an SQL/MX or FS exception occurs while the base table and LOB table are being updated, the
internal transaction used for this operation is rolled back, and an exception is thrown.
When an SQL/MX or file system exception occurs while JDBC/MX mimics autocommit mode for
the base table and the insert or update operations on a LOB table, the internal transaction used
for this operation is rolled back and the following exception is thrown:
Transaction error {0} - {1} while updating LOB tables
For the description, see the message information under “29070 HY000 Transaction error {0} - {1}
while updating LOB tables (page 90).
The JDBC/MX driver reserves data locators in its own transaction to improve the concurrency
among the different processes trying to reserve the data locators.
For more information, see “Transactions (page 33).
Access Considerations for Clob and Blob Objects
The JDBC/MX driver allows all the valid operations on the current Clob object or Blob object,
called a LOB object. LOB objects are current as long as the row that contains these LOB objects
is the current row. The JDBC/MX driver throws an SQLException, issuing the following message,
when the application attempts to perform operations on a LOB object that is not current:
Lob object {object-id} is not current
52 Working with BLOB and CLOB Data