Working with large objects
In this recipe, you will learn how to store and retrieve a LOB that can be one of three types—Binary Large Object (BLOB), Character Large Object (CLOB), and National Character Large Object (NCLOB).Â
Getting ready
The actual processing of LOB objects inside a database is vendor-specific, but JDBC APIs hide these implementation details from the application by representing the three LOB types as interfaces—java.sql.Blob
, java.sql.Clob
, and java.sql.NClob
.
Blob
is usually used to store images or other non-alphanumeric data. On the way to the database, an image can be converted into a stream of bytes and stored using the INSERT INTO
statement. The Blob
interface allows you to find the length of the object and convert it into an array of bytes that can be processed by Java for the purpose of displaying the image, for example. Â
Clob
 allows you to store character data. NClob
 stores Unicode character data as a way to support internationalization. It extends the Clob
 interface...