Create an IfxSmartBlob object

To create a smart large object and obtain access to the methods for performing operations on the object, call the IfxSmartBlob constructor, passing a reference to the JDBC connection:
IfxSmartBlob smb = new IfxSmartBlob(myConn)
Once you have written all the methods that perform operations you need in the smart large object, you can then use the IfxSmartBlob.IfxLoCreate() method to create the large object in the database server and open it for access within your application. The method signature is as follows:
public int  IfxLoCreate(IfxLobDescriptor loDesc, int flag, 
   IfxLocator loPtr) throws SQLException
public int  IfxLoCreate(IfxLobDescriptor loDesc, int flag, 
   IfxBblob blob)throws SQLException
public int  IfxLoCreate(IfxLobDescriptor loDesc, int flag, 
   IfxCblob clob throws SQLException

The return value is the locator handle, which you can use in subsequent read, write, seek, and close methods (you can pass it as the locator file descriptor (lofd) parameter to the methods that operate on open smart large objects; these methods are described beginning with Position within a smart large object).

The flag parameter is an integer value that specifies the access mode in which the new smart large object is opened in the server. The access mode determines which read and write operations are valid on the open smart large object. If you do not specify a value, the object is opened in read-only mode.

Use the access mode flag values in the following table with the IfxLoCreate() and IfxLoOpen() methods to open or create smart large objects with specific access modes.
Access mode Purpose Flag value in IfxSmartBlob
Read only Allows read operations only LO_RDONLY
Write only Allows write operations only LO_WRONLY
Write/Append Appends data you write to the end of the smart large object By itself, it is equivalent to write-only mode followed by a seek to the end of the smart large object. Read operations fail. When you open a smart large object in write/append mode only, the smart large object is opened in write-only mode. Seek operations move the seek position, but read operations to the smart large object fail, and the seek position remains unchanged from its position just before the write. Write operations occur at the seek position, and then the seek position is moved. LO_APPEND
Read/Write Allows read and write operations LO_RDWR
The following example shows how to use a LO_RDWR flag value:
IfxSmartBlob smb = new IfxSmartBlob(myConn);
int loFd = smb.IfxLoCreate(loDesc, smb.LO_RDWR, loPtr);

The loDesc and loPtr objects are previously created IfxLobDescriptor and IfxLocator objects, respectively.

The database server uses the following system defaults when it opens a smart large object.
Open-mode information
Default open mode
Access mode
Read-only
Access method
Random
Buffering
Buffered access
Locking
Whole-object locks

For more information about locking, see Work with locks.

The following table provides the full set of open-mode flags:
Open-mode flag Description
LO_APPEND Appends data you write to the end of the smart large object

By itself, it is equivalent to write-only mode followed by a seek to the end of the smart large object. Read operations fail.

When you open a smart large object in write/append mode only, the smart large object is opened in write-only mode. Seek operations move the seek position, but read operations to the smart large object fail, and the seek position remains unchanged from its position just before the write. Write operations occur at the seek position, and then the seek position is moved.

LO_WRONLY Allows write operations only
LO_RDONLY Allows read operations only
LO_RDWR Allows read and write operations
LO_DIRTY_READ For open only

Allows you to read uncommitted data pages for the smart large object

You cannot write to a smart large object after you set the mode to LO_DIRTY_READ. When you set this flag, you reset the current transaction isolation mode to Dirty Read for the smart large object.

Do not base updates on data that you obtain from a smart large object in Dirty Read mode.

LO_RANDOM Overrides optimizer decision

Indicates that I/O is random and that the database server should not read ahead. Default open mode.

LO_SEQUENTIAL Overrides optimizer decision

Indicates that reads are sequential in either forward or reverse direction.

LO_FORWARD Used only for sequential access to indicate forward direction
LO_REVERSE Used only for sequential access to indicate reverse direction
LO_BUFFER Use standard database server buffer pool.
LO_NOBUFFER Do not use the standard database server buffer pool. Use private buffers from the session pool of the database server.
LO_NODIRTY_READ Do not allow dirty reads on smart large object. See LO_DIRTY_READ flag for more information.
LO_LOCKALL Specifies that locking will occur on entire smart large object
LO_LOCKRANGE Specifies that locking will occur for a range of bytes

You specify the range of bytes through the IfxSmartBlob.IfxLoLock() method when you place the lock.