Using LOBs
The term large object (LOB) refers to any type of large object. Db2 supports three LOB data types: binary large object (BLOB), character large object (CLOB), and double-byte character large object (DBCLOB).
These LOB data types are represented symbolically as SQL_BLOB,
SQL_CLOB, SQL_DBCLOB respectively. All Db2 ODBC functions that accept or return SQL
data type arguments (for example, the SQLBindParameter()
and SQLDescribeCol()
functions)
can accept or return LOB symbolic constants.
An application can retrieve and manipulate LOB values in the application
address space. However, your application might not require you to
transfer the entire LOB from the database server into application
memory. In many cases, you can select a LOB value and operate on pieces
of it. The ODBC model can transfer LOB data using the piecewise sequential
method with SQLGetData()
and SQLPutData()
.
This method might prove inefficient. You can more efficiently retrieve
and manipulate an individual LOB value by using a LOB locator.
Another alternative for avoiding the use of application storage is to use file reference variables. With file reference variables, you retrieve LOB values directly from columns into files, or you update LOB column data directly from files.