Choosing the code page, territory, and collation for your database

The database code page determines what characters you can store in the database. For example, if the database code page is 819, then only English and western European characters can be stored in the database. A code page is a numeric value given to a named code set.

About this task

Starting in Db2® 9.5, if you do not specify the database code page when you create the database, the database code page defaults to Unicode. If you specify the database code page, you must also specify the territory.

The default territory depends on the locale of the client that issues the CREATE DATABASE command or sqlecrea API. See the "Date and time formats by territory code" topic for details.

The default database collation is SYSTEM. The actual SYSTEM collation table used is dependent on the database territory.

You cannot change the database code page, territory code, and collation once the database is created. For a list of supported database code page, territory code, and default SYSTEM collation table, see the "Supported territory codes and code pages" topic.

Procedure

  • To create a database with a particular database code page, territory, and collation, issue the following command.
    CREATE DATABASE dbname USING CODESET codeset 
           TERRITORY territory COLLATE USING collation
    For example, to create a non-Unicode database with Vietnam as the territory and using the default SYSTEM collation, issue the following command:
    CREATE DATABASE dbname USING CODESET IBM-1129 TERRITORY VN
  • To create a non-Unicode database using the sqlecrea API, set the values in sqledbterritoryinfo accordingly.
    Set SQLDBCODESET to a valid code set name and SQLDBLOCALE to any valid territory identifier.
    For example, to create a non-Unicode database with Vietnam as the territory, set SQLDBCODESET to IBM-1129 and SQLDBLOCALE to VN.