territory=ll_CC attribute

Function

When creating a database, use this attribute to associate a non-default locale with the database. Setting the territory=ll_CC attribute overrides the default system locale for that database. To find the default system locale, use the java.util.Locale.getDefault method.

Specify a locale in the form ll_CC, where ll is the two-letter language code, and CC is the two-letter country code.

Language codes consist of a pair of lowercase letters that conform to ISO 639-1. The following table shows some examples.

Table 1. Sample language codes
Language Code Description
de German
en English
es Spanish
ja Japanese

To see a full list of ISO 639 codes, go to http://www.loc.gov/standards/iso639-2/php/code_list.php.

Country codes consist of two uppercase letters that conform to ISO 3166. The following table shows some examples.

Table 2. Sample country codes
Country Code Description
DE Germany
US United States
ES Spain
MX Mexico
JP Japan

A copy of ISO 3166 can be found at http://userpage.chemie.fu-berlin.de/diverse/doc/ISO_3166.html .

Combining with other attributes

Use the territory=ll_CC attribute only when you create a database.

In the following example, the new database has a locale of Spanish language and Mexican nationality.

jdbc:derby:MexicanDB;create=true;territory=es_MX

You can use the collation=collation attribute with the territory=ll_CC attribute to specify that collation is based on the locale, instead of being based on Unicode codepoint collation. For more information, see "Creating a database with locale-based collation", "Creating a case-insensitive database", and "Character-based collation in Derby" in the Derby Developer's Guide.