JDBC Type 4 Driver Programmer's Reference for SQL/MX Release 3.2.1

This chapter describes working with BLOB and CLOB data in JDBC applications. You can use the
standard interface described in the JDBC 3.0 API specification to access BLOB and CLOB data in
NonStop SQL/MX tables with support provided by the Type 4 driver.
BLOB and CLOB are not native data types in an SQL/MX database. But, database administrators
can create SQL/MX tables that have BLOB and CLOB columns by using the Type 4 driver or special
SQL syntax in MXCI as described under Creating Base Tables that Have LOB Columns.
For management purposes, CLOB and BLOB data is referred to as large object (LOB) data, which
can represent either data type.
NOTE: CLOB data types are not supported when using stored procedures in Java (SPJs).
For information about creating and managing tables for BLOB and CLOB data, see “Managing
the SQL/MX Tables for BLOB and CLOB Data” (page 64).
Architecture for LOB Support
The tables that support LOB data are:
Base table
Referenced by JDBC applications to insert, store, read, and update BLOB and CLOB data. In the
base table, the Type 4 driver maps the BLOB and CLOB columns into a data-locator column. The
data-locator column points to the actual LOB data that is stored in a separate user table called the
LOB table.
LOB table
Actually contains the BLOB and CLOB data in chunks. A Clob or Blob object is identified by a
data locator. LOB tables have two formats: LOB table for BLOB data and a LOB table for CLOB
data.
Figure 3 LOB Architecture: Tables for LOB Data Support
Types of LOB Table
The LOB table is a separate table from the base table that stores the LOB data. The two types of
LOB table are: Binary or ASCII LOB and Unicode LOB.
The Binary or ASCII LOB table structure is:
table_name CHAR(128) NOT NULL NOT DROPPABLE,
data_locator LARGEINT NOT NULL NOT DROPPABLE,
chunk_no INT NOT NULL NOT DROPPABLE,
lob_data VARCHAR(3880)
The Unicode LOB table structure for ASCII data is:
table_name CHAR(128),
data_locator LARGEINT,
chunk_no INTEGER,
lob_data VARCHAR(1955) CHARACTER SET UCS2
Setting Properties for the LOB Table
“Specifying the LOB Table (page 56)
“Reserving Data Locators (page 56)
Architecture for LOB Support 55