JDBC Type 4 Driver 1.1 Programmer's Reference

from myTable where ….for update");
if (rs.next())
myCLOB = rs.getClob(1);
You can now write data to the CLOB column. See Writing ASCII or Unicode Data to a CLOB
Column.
Note: Limitation: Do not rename the CLOB column in the select query.
Writing ASCII or MBCS Data to a CLOB Column
You can write ASCII or MBCS data to a CLOB column.
Note: Multibyte Character Set (MBCS) data and ASCII data are handled the same way.
ASCII Data
To write ASCII or MBCS data to the CLOB column, use the Clob interface. The following
code illustrates using the setAsciiStream method of the Clob interface to write CLOB
data.
// stream begins at position: 1
long pos = 1;
//String containing the ASCII data
String s ;
// Obtain the output stream to write Clob data
OutputStream os = myClob.setAsciiStream(pos);
// write Clob data using OutputStream
byte[] myClobData = s.getBytes();
os.write(myClobData);
The Type 4 driver splits the output stream into chunks and stores the chunks in the LOB table.
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 (?)");