Creating smart large objects

About this task

The smart large object implementation is based on the following classes:
  • IfxLobDescriptor stores attributes for the large object.
  • IfxLocator contains the handle to the large object in the database server.
  • IfxSmartBlob contains methods for working with the smart large object, such as positioning within the object, reading data from the object, and writing data to the object.
  • IfxBblob and IfxCblob implement the java.sql.Blob and java.sql.Clob interfaces from the JDBC 3.0 specification.
  • IfxLoStat stores status information about the large object.
Tip: This section describes how to use the HCL OneDB™ smart-large-object interface, but it does not currently document every method and parameter in the interface. For a comprehensive reference to all the methods in the interface and their parameters, see the javadoc files for HCL OneDB JDBC Driver, located in the doc/javadoc directory where your driver is installed.

To create a smart large object:

Procedure

  1. For a new smart large object, ensure that the smart large object has an sbspace specified for its data.

    For detailed documentation about the onspaces utility that creates sbspaces, see the HCL OneDB Administrator's Guide. For an example of creating an sbspace, see Example of setting sbspace characteristics.

  2. Create an IfxLobDescriptor object.

    This allows you to set storage characteristics for the smart large object. The driver passes the IfxLobDescriptor object to the database server when the IfxSmartBlob.IfxLoCreate() method creates the large object.

  3. If desired, call methods in the IfxLobDescriptor object to specify storage characteristics.

    For most smart large objects, the sbspace name is the only storage characteristic that you need to specify. The database server can calculate values for all other storage characteristics. You can set particular storage characteristics to override these calculated values. However, most applications do not need to set storage characteristics at this level of detail. For more information, see Work with storage characteristics.

  4. Create an IfxLocator object.

    This is the pointer to the smart large object on the client.

  5. Create an IfxSmartBlob object.

    This lets you perform various common operations on the smart large object.

  6. Execute the IfxSmartBlob.IfxLoCreate() method to create the large object in the database server.

    IfxLoCreate() takes the IfxLocator and IfxLobDescriptor objects as parameters to identify the smart large object in the database server.

  7. Execute IfxSmartBlob.IfxLoWrite() to write data to the smart large object in the database server.
  8. Execute additional IfxSmartBlob methods to position within the object, read from the object, and so forth.
  9. Execute IfxSmartBlob.IfxLoClose() to close the large object.
  10. Insert the smart large object into the database (see Inserting a smart large object into a column).
  11. Execute IfxSmartBlob.IfxLoRelease() to release the locator pointer.