Using jConnect to pass Unicode data

In Adaptive Server version 12.5 and later, database clients can take advantage of the unichar and univarchar datatypes. The two datatypes allow for the efficient storage and retrieval of Unicode data.

Quoting from the Unicode Standard, version 2.0:

“The Unicode Standard is a fixed-width, uniform encoding scheme for encoding characters and text. The repertoire of this international character code for information processing includes characters for the major scripts of the world, as well as technical symbols in common. The Unicode character encoding treats alphabetic characters, ideographic characters, and symbols identically, which means they can be used in any mixture and with equal facility. The Unicode Standard is modeled on the ASCII character set, but uses a 16-bit encoding to support full multilingual text.”

This means that the user can designate database table columns to store Unicode data, regardless of the default character set of the server.

NoteIn Adaptive Server version 12.5 through 12.5.0.3, the server had to have a default character set of utf-8 in order to use the Unicode datatypes. However, in Adaptive Server 12.5.1 and later, database users can use unichar and univarchar without having to consider the default character set of the server.

When the server accepts unichar and univarchar data, jConnect behaves as follows:

For example, if a client attempts to send a Unicode Japanese character to an Adaptive Server 12.5.1 that has iso_1 as the default character set, jConnect detects that the Japanese character cannot be converted to an iso_1 character. jConnect then sends the string as Unicode data.

There is a performance penalty when a client sends unichar/univarchar data to a server. This is because jConnect must perform character-to-byte conversion twice for all strings and characters that do not map directly to the default character set of the server.

If you are using a jConnect version that is earlier than 6.05 and you wish to use the unichar and univarchar datatypes, you must perform the following tasks:

  1. Set the JCONNECT_VERSION = 6 or later. See “Using JCONNECT_ VERSION” for more information.

  2. You need to set the DISABLE_UNICHAR_SENDING connection property to false. Starting with jConnect 6.05 this property is set to false by default. See “Setting connection properties” for more information.

NoteFor more information on support for unichar and univarchar datatypes, see the Adaptive Server Enterprise manuals.