JDBC Type 4 Driver Programmer's Reference for SQL/MX Release 3.2.1
Internationalization (I18N) Support
“String Literals Used in Applications” (page 28)
“Controlling String Literal Conversion by Using the Character-Set Properties” (page 28)
“Trimming Padding for Fixed-Length Character Columns” (page 30)
“Localizing Error Messages and Status Messages” (page 31)
String Literals Used in Applications
Internationalization support in the driver affects the handling of string literals. The Type 4 driver
handles string literals in two situations:
• The driver processes an SQL statement. For example:
Statement stmt = conection.getStatement();
stmt.execute(“select * from table1 where col1 = ‘abcd’”);
• The driver processes JDBC parameters. For example:
PreparedStatement pStmt = connection.prepareStatement(“select * from table1 where col1 = ?”);
pStmt.setString(1, “abcd”);
To convert a string literal from the Java character set to an array of bytes for processing by the
SQL/MX engine, the Type 4 driver uses the column type and character set in the database. For
information about column data types and character sets, see the HP NonStop SQL/MX Release
3.2.1 Reference Manual.
Controlling String Literal Conversion by Using the Character-Set Properties
The Type 4 driver provides character-set mapping properties. These properties allow you to explicitly
define the translation of internal SQL/MX database character-set formats to and from the Java
string Unicode (UnicodeBigUnmarked) encoding.
The Type 4 driver provides the following character-set mapping properties using key values as
follows:
Default ValueKey
ISO88591_1ISO88591
SJISKANJI
EUC_KRKSC5601
A description of these character sets appears in the following table, which summarizes the character
sets supported by SQL/MX.
Table 2 Corresponding SQL/MX Character Sets and Java Encoding Sets
Description
Corresponding JavaEncoding
Set—Canonical Name for java.io and
java.lang APISQL/MX Character Set
Single-character, 8- bit, character set for
character-data type. ISO88591 supports
ISO88591_1ISO88591
English and other Western European
languages.
The multi-byte character set widely used on
Japanese mainframes. KANJI is composed
SJISKANJI
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.
28 Accessing SQL Databases with SQL/MX