O'Reilly logo

Java Programming with Oracle SQLJ by Jason Price

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

7.2. Large Objects (LOBs)

SQLJ supports three large object types, each of which stores a particular type of data. When you write an application, you need to choose the particular LOB type suited to the type of data you are manipulating. The three LOB types are as follows:

CLOB

The Character LOB type, used to store single-byte character data.

BLOB

The Binary LOB type, used to store binary data.

BFILE

The Binary file type, used to store pointers to files located outside the database. You can read the contents of such a file as a stream of bytes via a BFILE pointer. The external files can be on a hard disk, CD-ROM, DVD-ROM, or other device.

Prior to Oracle8, your only choice for storing large amounts of character or binary data was to use the LONG and LONG RAW types. The newer CLOB and BLOB types have three advantages over the LONG and LONG RAW types:

  • LOBs can store up to 4GB of data, double the 2GB capacity of LONG and LONG RAW columns.

  • LOB contents can be accessed randomly, whereas LONG and LONG RAW contents can only be accessed sequentially.

  • A table can contain multiple LOB columns, but only one LONG or LONG RAW column.

LOBs are composed of two parts:

locator

A LOB's locator is a pointer that specifies the location of the LOB content.

content

Content refers to the actual characters, or bytes, that are stored in the LOB. If the content is less than 4KB in size, it is stored in the table containing the LOB column; otherwise, it is stored outside the table. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required