JDBC Type 4 Driver 2.0 Programmer's Reference (SQL/MX 2.x)

Inserting CLOB Data by Using the PreparedStatement Interface
You can use the PreparedStatement interface to insert a CLOB column using ASCII or MBCS
data.
ASCII Data
To insert a CLOB column using ASCII or MBCS data from an InputStream, use the
PreparedStatement interface to insert the CLOB column.
InputStream inputAsciiStream;
PreparedStatement ps = conn.prepareStatement("insert
into myTable (myClobColumn) values (?)");
ps.setAsciiStream(1, inputAsciiStream, length_of_data);
ps.executeUpdate();
The Type 4 driver reads the data from InputStream and writes the data to the LOB table. The Type 4
driver substitutes the next-available data locator for the parameter of the CLOB column in the table.
Inserting a Clob Object by Using the setClob Method
Your JDBC application cannot directly instantiate a Clob object. To perform an equivalent operation:
Obtain a Clob object by using the getClob method of the ResultSet interface.1.
Insert the Clob object into another row by using the setClob method of the
PreparedStatement interface.
2.
In this situation, the Type 4 driver generates a new data locator and, when the PreparedStatement
is executed, copies the contents of the source Clob into the new Clob object.
Inserting a CLOB column with Unicode data using a Reader
You can use the PreparedStatement interface to insert a CLOB column with Unicode data using a
Reader.
Reader inputReader;
PreparedStatement ps = conn.prepareStatement("insert into
myTable (myClobColumn) values (?)");
ps.setCharacterStream(1, inputReader, length_of_data);
ps.executeUpdate();
Type 4 driver reads the data from a Reader and internally SQLMXClobWriter writes the data to the
LOB table. Type 4 driver substitutes the next available data locator to the parameter of the CLOB
column in the base table.