Derby supports the ability to define collation rules that are appropriate to a locale. This is referred to as locale-based collation.
Derby supports the locales that the Java programming language supports. In addition, it is possible to create customized locales. For details, see Creating a customized collator.
You can set the locale of a database when you create the database by specifying the territory=ll_CC attribute. (See Creating a database with locale-based collation for details.) If you do not specify a locale, Derby uses the default locale of the JVM in which the database is created.
At the same time, you can also specify locale-based collation by using the collation=collation attribute, and you can specify a particular collation strength to make the database either case-sensitive or case-insensitive, or to respect both case and accent in collation. See Creating a case-insensitive database for information on making the database use case-insensensitive searches.
Each JVM can support many locales that are independent of the default locale for the JVM. Collation support for these additional locales is provided through the java.text.RuleBasedCollator class and the set of rules for these locales. Refer to the JVM specification for details of how these rules are used to provide locale-specific collation.
The locale-based collation in Derby affects how the CHAR and VARCHAR data types are compared. Specifying locale-based collation also impacts how the LIKE Boolean operator processes CHAR, VARCHAR, CLOB, and LONG VARCHAR data.
Locale-based collation adds some extra processing overhead to all character-based comparison operations.