Red Hat Training

A Red Hat training course is available for Red Hat JBoss Data Virtualization

10.7. Large Objects (LOBs)

Large Objects (LOBs) consist of data. The three main large object runtime data types used by JBoss are:
  1. Binary (BLOB)
    • Contains multimedia objects such as images and audio.
  2. Character (CLOB)
    • Contains ASCII characters.
  3. Extensible Markup Language (XML)
    • Contains textual data.
LOBs and JBoss

The JBoss Data Services Connector API returns a reference to the LOB if allowed by the JBoss Data Services server. The JBoss Data Services server or JDBC driver can then access the data via a stream rather than retrieving the data all at once. This is useful for several reasons:

  • Reduces memory usage when returning the result set to the user.
  • Improves performance by passing less data in the result set.
  • Enables access to LOBs when required rather than assuming that users will always use the LOB data.
  • Enables handling of arbitrarily large data values within a fixed JBoss Data Services memory usage.
These benefits are achieved if the Connector itself does not materialize an entire LOB all at once. For example, the JDBC API supports a streaming interface for BLOB and CLOB data.
Source LOB values are typically accessed by reference, rather than having the value copied to a temporary location. Care must be taken to ensure that source LOBs are returned in a memory-safe manner.
LOBs are broken into pieces when being created and streamed. The size of each piece when fetched by the client can be configured.
Cached lobs will be copied rather than relying on the reference to the source lob.
Temporary lobs created by Teiid will be cleaned up when the result set or statement is closed. To rely on implicit garbage collection based cleanup instead of statement close, the Teiid session variable clean_lobs_onclose can be set to false (by issuing the query "SELECT teiid_session_set('clean_lobs_onclose', false)" - which can be done for example via the new connection sql in the datasource definition). This can be used for local client scenarios that relied on the implicit behavior, such as Designer generated REST VDBs.