JDBC Programming with Unicode
conversion before being processed. The database, in turn, converts the SQL statements from UTF-8 to the database character set. The database, in turn, converts the SQL statement to the database character set. For Java string bind and define variables, the conversion paths shown in Table 7–6 are taken for the thin driver. Table 7–6
Thin Driver Conversion Path Database Character Set
Conversion Path
CHAR
US7ASCII or WE8ISO8859P1
Java string to and from the database character set happens in the thin driver.
NCHAR
US7ASCII or WE8ISO8859P1
Java string to and from the database character set happens in the thin driver.
Form of Use
SQL Datatype
Const.CHAR (Default) Const.CHAR (Default)
Data in the database character set to and from the national character set happens in the database server. Const.CHAR (Default)
CHAR
non-ASCII and non-WE8ISO8859P1
Java string to and from UTF-8 happens in the thin driver. Data in UTF-8 to and from the database character set happens in the database server.
Const.CHAR (Default)
NCHAR
non-ASCII and non-WE8ISO8859P1
Java string to and from UTF-8 happens in the thin driver. Data in UTF-8 to and from national character set happens in the database server.
Const.NCHAR
CHAR
Java string to and from the national character set happens in the thin driver. Data in the national character set to and from the database character set happens in the database server.
Const.NCHAR
NCHAR
Java string to and from the national character set happens in the thin driver.
Data Conversion for the Server-Side Internal Driver All data conversion occurs in the database server because the server-side internal driver works inside the database.
Using oracle.sql.CHAR in Oracle Object Types JDBC drivers support Oracle object types. Oracle objects are always sent from database to client as an object represented in the database character set or national character set. That means the data conversion path in "Data Conversion in JDBC" on page 7-23 does not apply to Oracle object access. Instead, the oracle.sql.CHAR class is used for passing SQL CHAR and SQL NCHAR data of an object type from the database to the client. This section includes the following topics: ■
oracle.sql.CHAR
■
Accessing SQL CHAR and NCHAR Attributes with oracle.sql.CHAR
oracle.sql.CHAR The oracle.sql.CHAR class has a special functionality for conversion of character data. The Oracle character set is a key attribute of the oracle.sql.CHAR class. The Oracle character set is always passed in when an oracle.sql.CHAR object is
7-24 Oracle Database Globalization Support Guide