AS400JDBCClob class

You can use a AS400JDBCClob object to access character large objects (CLOBs), such as large documents.

AS400JDBCClob

The key difference between the AS400JDBCClob class and the AS400JDBCClobLocator class is where the blob is stored. With the AS400JDBCClob class, the clob is stored in the database, which inflates the size of the database file. The AS400JDBCClobLocator class stores a locator (think of it as a pointer) in the database file that points to where the clob is located.

With the AS400JDBCClob class, the lob threshold property can be used. This property specifies the maximum large object (LOB) size (in kilobytes) that can be retrieved as part of a result set. LOBs that are larger than this threshold are retrieved in pieces using extra communication to the server. Larger LOB thresholds reduce the frequency of communication to the server, but they download more LOB data, even if it is not used. Smaller lob thresholds may increase frequency of communication to the server, but they only download LOB data as it is needed. See IBM Toolbox for Java JDBC properties for information on additional properties that are available.

Using the AS400JDBCClob class, you can do the following:

Examples

The following examples show how to use the AS400JDBCClob class to read from a clob and update a clob:

Example: Using the AS400JDBCClob class to read from a clob

     Clob clob = rs.getClob(1);
     int length = clob.length();
     String s = clob.getSubString(1, (int) length);

Example: Using the AS400JDBCClob class to update a clob

     ResultSet rs = statement.executeQuery ("SELECT CLOB FROM MYTABLE");
     rs.absolute(4);
     Clob clob = rs.getClob(1); 

          // Change the characters in the clob, starting at the third character
          // of the clob
     clob.setString (3, "Small");

          // Update the clob in the result set, starting at the third character
          // of the clob and truncating the clob at the end of the update string
          // (the clob now has 7 characters).
     rs.updateClob(1, clob);                    

          // Update the database with the updated clob.  This will change the
          // clob in the database starting at the third character of the clob,
          // and truncating at the end of the update string.
     rs.updateRow();                                                       
     rs.close();

AS400JDBCClobLocator class

You can use a AS400JDBCClobLocator object to access character large objects (CLOBs).

Using the AS400JDBCClobLocator class, you can do the following: