JDBC Type 4 Driver Programmer's Reference for SQL/MX Release 3.1 (H06.23+, J06.12+)
where getColumn1() returns the following stored bytes:
0x83 0x42 0x83 0x42 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20
The driver creates a String object.
String s1 = new String(outB1, “SJIS”);
The resulting String object has the following UCS2 encoding:
0x30 0xA2 0x30 0xA3 0x00 0x20 0x00 0x20 0x00 0x20 0x00 0x20 0x00 0x20 0x00 0x20 0x00 0x20 0x00 0x20
The resulting string would be 10 characters (2 characters following by 8 UCS2 spaces). This length is 4 characters more than the column length
(which is 6).
Localizing Error Messages and Status Messages
The Type 4 driver supports Internationalization through resource bundles for localized error messages and status messages. The driver uses a
set of static strings from a property file to map error messages and status messages to their textual representation.
File-Name Format for the Localized-Messages File
The property file that has the messages must have a file name in the form:
SQLMXMessages_xx.properties
where xx is the locale name. The locale name is defined by the current default locale or by the language property.
The
Type 4 driver is shipped with an error messages and status messages property file that contains the textual representation of errors and
status messages for the English locale. The file is named
SQLMXMessages_en.properties.
Localized-Message String Format
A localized message file contains strings in the form:
message=message_text
For example:
driver_err_error_from_server_msg=An error was returned from the server. Error: {0} Error detail: {1}
where the message is driver_err_error_from_server_msg. The message_text is: An error was returned from the server. Error: {0} Error
detail: {1}
The pattern {n} inmessage_text, where n equals 1, 2, 3, and so forth, is a placeholder that is filled in at run time by the Type 4 driver. Any
translation must include these placeholders.
Procedure To Create a Localized-Message File
1. Extract the SQLMXMesseges_en.properties file, which is in the t4sqlmx.jar file. For example from a UNIX prompt, use the jar Java tool:
jar -x SQLMXMessages_en.properties < t4sqlmx.jar
2. Copy the file.
3. Edit the file and replace the English text with the text for your locale.
4. Save the file, giving it a file name that meets the naming requirements described under
File-Name Format for Localized Messages.
5. Put the file in a directory anywhere in the class path for running the JDBC application.
The new messages file can be anywhere in the class path for running the user application.
At run time, if driver cannot read the messages property file, the driver uses the message portion of the property as the text of the message. For a
description of the message portion, see the
Localized-Message String Format.
At run time, if the Type 4 driver cannot read the messages property file, it sets the locale to English locale, thereby loading the default properties
file that is shipped with the Type 4 Driver. The default properties file,
SQLMXMessages_en.properties, fetches the error messages and status
messages.
Prev Up Next
Chapter 2. Installing and Verifying the Type 4
Driver
Home
Chapter 4. Type 4 Driver Properties
Part Number
663860-001 Legal Notices










