Neoview JDBC Type 4 Driver Programmer's Reference (R2.2, R2.3, R2.4, R2.5)

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 -Dhpt4jdbc.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);
> java DISO88591=SJIS test1.java
The following method invocation sets column one of stmt to the String “abcd” where “abcd”
is encoded as SJIS. The charset parameter to the String getBytes method is SJIS
stmt.setString(1, "abcd");
Controlling What Happens on an Exception
You can use the translationVerification property to explicitly define the behavior of the
driver if the driver cannot translate all or part of an SQL parameter. The value portion of the
property can be TRUE or FALSE. (The default value is FALSE).
If the translationVerification property’s value is FALSE and the driver cannot translate
all or part of an SQL statement, the translation is unspecified. In most cases, the characters that
are untranslatable are encoded as ISO88591 single-byte question marks (‘?’ or 0x3F). No exception
or warning is thrown.
If the translationVerification property’s value is TRUE and the driver cannot translate
all or part of an SQL statement, the driver throws an SQLException with the following text:
Translation of parameter to {0} failed. Cause: {1}
where {0} is replaced with the target character set and {1} is replaced with the cause of the
translation failure.
For more information, see “translationVerification Property” (page 49).
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:
32 Accessing Neoview SQL Databases