There are a number of tasks that can be performed with database CLOB and DBCLOB columns through the Java™ Database Connectivity (JDBC) Application Programming Interface (API). The following topics briefly discuss these tasks and include examples on how to accomplish them.
With the JDBC API, there are ways to get CLOBs out of the database and ways to put CLOBs into the database. However, there is no standardized way to create a Clob object. This is not a problem if your database is already full of CLOBs, but it poses a problem if you want to work with CLOBs from scratch through JDBC. Instead of defining a constructor for the Blob and Clob interfaces of the JDBC API, support is provided for placing CLOBs into the database and getting them out of the database directly as other types. For example, the setCharacterStream method can work with a database column of type Clob. Example: CLOB shows some of the common ways that a CLOB can be put into the database or retrieved from the database.
CLOBs are defined in JDBC as an interface of which the various drivers provide implementations. This interface has a series of methods that can be used to interact with the Clob object. This example shows some of the common tasks that can be performed using this API. Consult the JDBC Javadoc for a complete list of available methods on the Clob object.
In JDBC 3.0, there is support for making changes to LOB objects. These changes can be stored into CLOB columns in the database. This example shows some of the tasks that can be performed with CLOB support in JDBC 3.0.