Manage memory for large objects
Whenever a large object (a BYTE, TEXT, BLOB, or CLOB data type) is fetched from the database server, the data is either cached into memory or stored in a temporary file (if it exceeds the memory buffer).
- To set the maximum number of bytes allocated in memory to hold
the data, set the LOBCACHE value to that number
of bytes.
If the data size exceeds the LOBCACHE value, the data is stored in a temporary file. If a security violation occurs during creation of this file, the data is stored in memory.
- To always store the data in a file, set the LOBCACHE value
to
0
.In this case, if a security violation occurs, HCL OneDB™ JDBC Driver makes no attempt to store the data in memory.
- To always store the data in memory, set the LOBCACHE value
to a negative number.
If the required amount of memory is not available, HCL OneDB JDBC Driver throws the SQLException message
Out of Memory
.
If the LOBCACHE size is invalid or not defined, the default size is 4096.
URL = jdbc:onedb://158.58.9.37:9088/test;user=guest;password=iamaguest;lobcache=4096";
The preceding example stores the large object in memory if the size is 4096 bytes or fewer. If the large object exceeds 4096 bytes, HCL OneDB JDBC Driver tries to create a temporary file. If a security violation occurs, memory is allocated for the entire large object. If that fails, the driver throws an SQLException message.
URL = "jdbc:onedb://hostname:9088/testdb;user=guest;passwd=whoknows;lobcache=0";
The preceding example uses a temporary file for storing the fetched large object.
URL = "jdbc:onedb://icarus:7110/testdb;user=guest;passwd=whoknows;lobcache=-1";
The preceding example always uses memory to store the fetched large object.
For programming information about how to use the TEXT and BYTE data types in a Java™ program, see BYTE and TEXT data types. For programming information about how to use the BLOB and CLOB data types in a Java program, see Smart large object data types.