territory=ll_CC attribute The territory=ll_CC attribute associates a non-default locale with a database at database creation time. territory=ll_CC database connection URL attribute databasesspecifying locale localedatabase internationalization featuressetting locale attributesterritory

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.

Sample language codesThis table lists and describes some examples of language codes. Language Code Description de German en English es Spanish ja Japanese

To see a full list of ISO 639 codes, go to .

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

Sample country codesThis table lists and describes some examples of 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 .

Combining with other attributes

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

Example

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 " in the .