JDBC Type 4 Driver Programmer's Reference for SQL/MX Release 3.2.1
Table 2 Corresponding SQL/MX Character Sets and Java Encoding Sets (continued)
Description
Corresponding JavaEncoding
Set—Canonical Name for java.io and
java.lang APISQL/MX Character Set
NOTE: KAJNI is supported in SQL/MP
tables only.
Double-character character set required on
systems used by government and banking
EUC_KRKSC5601
within Korea. KSC5601 encoding is
big-endian.
NOTE: KSC5601 is supported in
SQL/MP tables only.
For more information on these properties, see the following:
• “ISO88591” (page 41)
• “KANJI” (page 42)
• “KSC5601” (page 42)
Using the Character-Set Properties
The java.sql.PreparedStatement class contains the methods setString() and
setCharacterStream(). These methods take a String parameter and Reader parameter,
respectively.
The java.sql.ResultSet class contains the methods getString() and
getCharacterStream(). These methods return a String parameter and Reader parameter,
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:
Internationalization (I18N) Support 29