Neoview JDBC Type 4 Driver Programmer's Reference (R2.2, R2.3, R2.4, R2.5)
Deleting BLOB Data
To delete BLOB data, the JDBC application uses the SQL DELETE statement to delete the row in
the base table.
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 Triggers to Delete LOB Data” (page 62).
See also “NULL and Empty BLOB or Empty CLOB Value” (page 58).
NULL and Empty BLOB or Empty CLOB Value
The data locator can have a NULL value if the BLOB or CLOB column is omitted in the insert
statement. The Type 4 driver returns NULL when the application retrieves the value for such a
column.
When the application uses the EMPTY_BLOB() function or the EMPTY_CLOB() function to insert
empty BLOB or CLOB data into the BLOB or CLOB column, the Type 4 driver returns the Blob or
Clob object with no data.
Transactions Involving Blob and Clob Access
You must ensure that your JDBC applications control the transactions when the BLOB columns
or CLOB columns are accessed or modified. To control the transaction, set the connection to
autocommit OFF mode.
All LOB data access or modification is done under the application's transaction. When the
autocommit mode is ON and LOB data is accessed or modified, the Type 4 driver throws the
SQLException, Autocommit is on and LOB objects are involved.
Access Considerations for Clob and Blob Objects
The Type 4 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 Type 4 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
Only one InputStream or Reader and one OutputStream or Writer can be associated with
the current LOB object.
• When the application obtains the InputStream or Reader from the LOB object, the Type
4 driver closes the InputStream or Reader that is already associated with the LOB object.
• Similarly, when the application obtains the OutputStream or Writer from the LOB object,
the Type 4 driver closes the OutputStream or Writer that is already associated with the
LOB object.
58 Working with BLOB and CLOB Data