JDBC Type 4 Driver 1.1 Programmer's Reference
ISO88591 ISO88591_1
KANJI SJIS
KSC5601 EUC_KR
A description of these character sets appears in the following table, which summarizes the character sets supported by
SQL/MX.
Table 3.1. Corresponding SQL/MX Character Sets and Java Encoding Sets
SQL/MX Character Set
Corresponding Java Encoding
Set—Canonical Name for java.io and
java.lang API
Description
ISO88591 ISO88591_1
Single-character, 8-bit, character set for
character-data type. ISO88591 supports English
and other Western European languages
KANJI SJIS
The multi-byte character set widely used on
Japanese mainframes. KANJI is composed for a
single-byte character set and a double-byte
character set. It is a subset of Shift JIS (the double
character portion). KANJI encoding is big-endian.
Note: KAJNI is supported in SQL/MP tables only
KSC5601 EUC_KR
Double-character character set required on
systems used by government and banking within
Korea. KSC5601 encoding is big endian. Note:
KSC5601 is supported in SQL/MP tables only.
For detailed information about these properties, see ISO88591 Property, KANJI Property or KSC5061 Property.
Using the Character-Set Properties
The java.sql.PreparedStatement class contains the methods setString() and setCharacterStream().
These methods take a String and Reader parameter, respectively.
The java.sql.ResultSet class contains the methods getString() and getCharacterStream(). These methods return a
String and Reader, respectively.
Retrieving a Column
When you retrieve a column as a String (for example, call the getString() or getCharacterStream methods), the
Type 4 driver uses the character-set mapping property key to instantiate a String object (where that key corresponds to the
character set of the column). For example: the following SQL create table statement creates a table that has an ISO88591
column
create table t1 (c1 char(20) character set ISO88591)
The JDBC program uses the following java command to set the ISO88591 property and issues the getString() method.
java –Dt4sqlmx.ISO88591=SJIS test1.java
// The following method invocation returns a String object, which
// was created using the “SJIS” Java canonical name as the charset
// parameter to the String constructor.
String s1 = rs.getString(1); // get column 1 as a String
Setting a Parameter
When you set a parameter by using a String (for example, call the setString() method), the Type 4 driver uses the key’s
value when generating the internal representation of the String (where that key corresponds to the character set of the column).
The character-set parameter to the String getBytes method is the Java Canonical name that corresponds to the column’s
character set.
For example, the following SQL create table statement creates a table that has an ISO88591 column:
create table t1 (c1 char(20) character set ISO88591);