Convert with the IFX_CODESETLOB environment variable
You can automate the following pair of code-set conversions
for TEXT and CLOB data types:
- Convert from client locale to database locale before the data is sent to the database server.
- Convert from database locale to client locale before the data is retrieved by the client.
To automate code-set conversion for TEXT and CLOB data
types, set the IFX_CODESETLOB environment variable
in the connection URL. For example:
IFX_CODESETLOB = 4096
.
You can also use the following methods of the IfxDataSource class
to set and get the value of IFX_CODESETLOB: public void setIfxIFX_CODESETLOB(int codesetlobFlag); public int getIfxIFX_CODESETLOB();
IFX_CODESETLOB can have the following
values:
- none
- Default
Automatic code-set conversion is not enabled.
- 0
- Automatic code-set conversion takes place in internal temporary files.
- > 0
- Automatic code-set conversion takes place in the memory of the
client computer. The value indicates the number of bytes allocated
for the conversion.
If the number of allocated bytes is less than the size of the large object, an error is returned.
To perform conversion in memory, you must specify an amount that is smaller than the memory limits of the client machines and larger than the possible size of any converted large object.
When
you are using any of the following java.sql.Clob interface
methods or HCL
OneDB™ extensions
to the Clob interface, no code-set conversion is performed, even if
the IFX_CODESETLOB environment variable is set.
These methods include:
IfxCblob::setAsciiStream(long) Clob::setAsciiStream(long position, InputStream fin, int length)
IFX_CODESETLOB takes effect only for methods from the java.sql.PreparedStatement interface.
However
when using any of following java.sql.Clob interface methods
or HCL
OneDB extensions
to Clob interface, Unicode characters are always converted automatically
to the database locale code set. Here is a list of those methods:
Clob::setCharacterStream(long) throws SQLException Clob::setString(long, String) throws SQLException Clob:: setString(long pos, String str, int offset, int len) IfxCblob::setSubString(long position, String str, int length)