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

When the Clob objects differ, the Clob object in the updateClob method behaves as if the
setClob method was issued. See “Inserting a Clob Object by Using the setClob Method”
(page 47).
Replacing Clob Objects
You can replace Clob objects in the following ways:
Use the EMPTY_CLOB() function to replace the Clob object with the empty Clob object,
then insert new data as described under “Inserting CLOB Columns by Using the Clob Interface
(page 46).
Use the PreparedStatement.setAsciiStream() or setCharacterStream() method
to replace the existing Clob object with new CLOB data.
Use the setClob or updateClob method to replace the existing CLOB objects as explained
earlier under “Inserting a Clob Object by Using the setClob Method” (page 47)and “Updating
Clob Objects with the updateClob Method” (page 48).
Deleting CLOB Data
To delete CLOB data, the JDBC application uses the SQL DELETE statement to delete the row in the
base table.
When the row containing the CLOB column is deleted by the JDBC application, the corresponding
CLOB 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).
Storing BLOB Data
You can perform operations similar to those used on CLOB columns as those used on BLOB columns
by using the Blob interface. You can:
Use the EMPTY_BLOB() function in the insert statement to create an empty BLOB column in
the database.
Use setBinaryStream method of the Blob interface to obtain the InputStream to read
BLOB data.
Use getBinaryStream method of the Blob interface to obtain the OutputStream to write
BLOB data.
Use setBinaryStream of the PreparedStatement interface to write the data to the BLOB
column.
The details of these operations are discussed in the following topics:
“Inserting a BLOB Column by Using the Blob Interface (page 49)
“Writing Binary Data to a BLOB Column (page 50)
“Inserting a BLOB Column by Using the PreparedStatement Interface (page 50)
“Inserting a Blob Object by Using the setBlob Method” (page 50)
Inserting a BLOB Column by Using the Blob Interface
When you insert a row containing a BLOB data type, you can insert the row with an "empty"
BLOB value before the column can be updated with real BLOB data. You can insert an empty
BLOB value in an SQL/MX database by specifying EMPTY_BLOB() function for the BLOB column
in the insert statement.
The JDBC/MX driver scans the SQL string for the EMPTY_BLOB() function and substitutes the
next-available data locator.
Deleting CLOB Data 49