Previous Topic

Next Topic

Book Contents

Book Index

Unicode support with DB2

This topic applies to DB2/UDB. We haven't yet investigated Unicode support with DB2 z/OS or DB2/400. If anybody has implemented Unicode with these databases we would be interested in any feedback.

Configuring the database

A DB2/UDB database can only store Unicode data if Unicode has been defined as the database character set. This is done when the database is defined, and cannot be done retrospectively.

Example of creating a Unicode database:

Create Database DB2UTF8 using codeset UTF-8 territory US

Setting the Client Codeset

If you are using a Unicode database, it is recommended that your client uses a Unicode codeset. You can set this by running the following command in a DB2 Command window:

db2set DB2CODEPAGE=1208

If this is not done, Unicode literals will not be interpretted correctly by DB2.

Data Types

In a Unicode database, all character types will hold data in Unicode. You can therefore use the standard Char and Varchar data types.

Unicode in Table and Column names

This is supported by DB2

Advanced Query Tool
https://www.querytool.com
© 2023 Cardett Associates Ltd. All rights reserved.