Author: rhillegas Date: Fri Aug 1 13:16:41 2014 New Revision: 918132 Log: DERBY-6588: Commit generated output for derby-6588-07-aa-add10.11branchToWebsite.diff.
Modified: websites/production/db/content/derby/dev/derby_source.html websites/production/db/content/derby/docs/10.10/devguide/tdevdvlpcaseinscoll.html websites/production/db/content/derby/docs/10.10/devguide/tdevdvlpcustomcollation.html Modified: websites/production/db/content/derby/dev/derby_source.html ============================================================================== --- websites/production/db/content/derby/dev/derby_source.html (original) +++ websites/production/db/content/derby/dev/derby_source.html Fri Aug 1 13:16:41 2014 @@ -240,6 +240,8 @@ Currently Derby has the following branch </p> <ul> +<li> 10.11 </li> + <li> 10.10 </li> <li> 10.9 </li> @@ -271,11 +273,11 @@ Use the command shown below to check out <p> Where <em>branch</em> is the number of the branch. For example, the following command checks out the source code for -the 10.10 branch: +the 10.11 branch: </p> -<pre class="code">svn co https://svn.apache.org/repos/asf/db/derby/code/branches/10.10/ +<pre class="code">svn co https://svn.apache.org/repos/asf/db/derby/code/branches/10.11/ </pre> -<a name="N10071"></a><a name="Development+trunk"></a> +<a name="N10074"></a><a name="Development+trunk"></a> <h3 class="boxed">Development trunk</h3> <p> Use the command shown below to check out the development trunk: @@ -324,13 +326,13 @@ The alpha version tag explicitly disable </div> -<a name="N100A5"></a><a name="Software+required+to+build+Derby"></a> +<a name="N100A8"></a><a name="Software+required+to+build+Derby"></a> <h2 class="boxed">Software required to build Derby</h2> <div class="section"> <p> -Derby is designed to work in JSR 169, JDBC 3.0, -JDBC 4.1, and JDBC 4.2 environments. In addition, optional run-time -code may take advantage of features introduced by Java 5 and later versions of the JVM. +Derby is designed to work in +JDBC 4.1 and JDBC 4.2 environments and on Java 8 compact profile 2 (for resource-limited devices). In addition, optional run-time +code may take advantage of features introduced by Java 7 and later versions of the JVM. </p> <p> The software required to build the Derby mainline is summarized in the table below. @@ -358,7 +360,7 @@ those instructions live in a file called <tr> -<td colspan="1" rowspan="1">Apache Ant 1.7.x</td> +<td colspan="1" rowspan="1">Apache Ant 1.9.2</td> <td colspan="1" rowspan="1"> <a class="external" href="http://ant.apache.org/bindownload.cgi">http://ant.apache.org/bindownload.cgi</a> </td> @@ -368,8 +370,8 @@ those instructions live in a file called <tr> -<td colspan="1" rowspan="1"> Java Development Kit (JDK) release 5 or later</td> - <td colspan="1" rowspan="1"> Any Java 5 or later JDK. Java's reference implementation is at +<td colspan="1" rowspan="1"> Java Development Kit (JDK) release 6 or later</td> + <td colspan="1" rowspan="1"> Any Java 6 or later JDK. Java's reference implementation is at <a class="external" href="http://www.oracle.com/technetwork/java/index.html">http://www.oracle.com/technetwork/java/index.html</a> </td> @@ -381,7 +383,7 @@ those instructions live in a file called </div> -<a name="N100EB"></a><a name="How+to+build+Derby"></a> +<a name="N100EE"></a><a name="How+to+build+Derby"></a> <h2 class="boxed">How to build Derby</h2> <div class="section"> <p> @@ -392,7 +394,7 @@ at the root of the source code tree. </div> -<a name="N100F9"></a><a name="How+to+test+Derby"></a> +<a name="N100FC"></a><a name="How+to+test+Derby"></a> <h2 class="boxed">How to test Derby</h2> <div class="section"> <p> @@ -414,7 +416,7 @@ resources. </div> -<a name="N10120"></a><a name="How+to+submit+a+patch"></a> +<a name="N10123"></a><a name="How+to+submit+a+patch"></a> <h2 class="boxed">How to submit a patch</h2> <div class="section"> <p> @@ -428,7 +430,7 @@ or Documentation</a> section in the <p> -<em>Last updated: March 18, 2013</em> +<em>Last updated: August 1, 2014</em> </p> Modified: websites/production/db/content/derby/docs/10.10/devguide/tdevdvlpcaseinscoll.html ============================================================================== --- websites/production/db/content/derby/docs/10.10/devguide/tdevdvlpcaseinscoll.html (original) +++ websites/production/db/content/derby/docs/10.10/devguide/tdevdvlpcaseinscoll.html Fri Aug 1 13:16:41 2014 @@ -1,105 +1,105 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" lang="en-us" xml:lang="en-us"> -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<head> -<meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> -<meta name="copyright" content="(C) Copyright 2005" /> -<meta name="DC.rights.owner" content="(C) Copyright 2005" /> -<meta content="public" name="security" /> -<meta content="index,follow" name="Robots" /> -<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' /> -<meta content="task" name="DC.Type" /> -<meta name="DC.Title" content="Creating a case-insensitive database" /> -<meta name="abstract" content="When you create a database using locale-based collation, the collation=collation value TERRITORY_BASED uses the default collation strength for the locale, usually TERTIARY, which will consider character case significant in searches and comparisons." /> -<meta name="description" content="When you create a database using locale-based collation, the collation=collation value TERRITORY_BASED uses the default collation strength for the locale, usually TERTIARY, which will consider character case significant in searches and comparisons." /> -<meta content="database attributes, case-insensitive collation, collation, case-insensitive" name="DC.subject" /> -<meta content="database attributes, case-insensitive collation, collation, case-insensitive" name="keywords" /> -<meta scheme="URI" name="DC.Relation" content="cdevcollation.html" /> -<meta scheme="URI" name="DC.Relation" content="cdevcollationoverview.html" /> -<meta scheme="URI" name="DC.Relation" content="cdevcollationlocale.html" /> -<meta scheme="URI" name="DC.Relation" content="cdevcollationattribs.html" /> -<meta scheme="URI" name="DC.Relation" content="cdevcollationexamples.html" /> -<meta scheme="URI" name="DC.Relation" content="cdevcollationlikeequal.html" /> -<meta scheme="URI" name="DC.Relation" content="tdevdvlpcustomcollation.html" /> -<meta scheme="URI" name="DC.Relation" content="tdevdvlpcollation.html" /> -<meta scheme="URI" name="DC.Relation" content="cdevdvlp51654.html" /> -<meta content="XHTML" name="DC.Format" /> -<meta content="tdevdvlpcaseinscoll" name="DC.Identifier" /> -<meta content="en-us" name="DC.Language" /> -<link href="commonltr.css" type="text/css" rel="stylesheet" /> -<title>Creating a case-insensitive database</title> -</head> -<body id="tdevdvlpcaseinscoll"><a name="tdevdvlpcaseinscoll"><!-- --></a> - - -<h1 class="topictitle1">Creating a case-insensitive database</h1> - - - -<div><p>When you create a database using locale-based collation, the -<em>collation=collation</em> value TERRITORY_BASED uses the default -collation strength for the locale, usually TERTIARY, which will consider -character case significant in searches and comparisons.</p> - -<div class="section"><p>To make the database use case-insensitive searches, specify an -explicit strength lower than TERTIARY with the <em>collation=collation</em> -attribute. The strength name is appended to TERRITORY_BASED with a colon to -separate them.</p> - -<p>For example, you could specify the following connection URL:</p> - -<pre>jdbc:derby:SwedishDB;create=true;territory=sv_SE;collation=TERRITORY_BASED:PRIMARY</pre> - -<p>With strength PRIMARY, the characters 'A' and 'a' will be considered equal, -as well as 'à ' ('a' with a grave accent). (This behavior is -commonly the default with many other databases.) To make searches -respect differences in accent, use strength SECONDARY.</p> - -<p>The exact interpretation of the strength part of the attribute depends upon -the locale.</p> - -<p>For more information, see -<a href="tdevdvlpcollation.html#tdevdvlpcollation">Creating a database with locale-based collation</a> and the -documentation of the <em>territory=ll_CC</em> and <em>collation=collation</em> -attributes in the <span><em>Derby Reference Manual</em></span>.</p> - -</div> - -</div> - -<div> -<div class="familylinks"> -<div class="parentlink"><strong>Parent topic:</strong> <a href="cdevdvlp51654.html" title="You specify attributes on the Derby connection URL.">Working with the database connection URL attributes</a></div> -</div> -<div class="relconcepts"><strong>Related concepts</strong><br /> -<div><a href="cdevcollation.html" title="A character set is a set of symbols and encodings. Character data types are represented as Unicode 2.0 sequences in Derby. Collation defines how character data is sorted.">Character-based collation in Derby</a></div> -<div><a href="cdevcollationoverview.html" title="Derby supports a wide range of character sets and encodes all of the character sets by using the Unicode support provided by the java.lang.Character class in the Java Virtual Machine (JVM) in which the Derby database runs.">How collation works in Derby</a></div> -<div><a href="cdevcollationlocale.html" title="Derby supports the ability to define collation rules that are appropriate to a locale. This is referred to as locale-based collation.">Locale-based collation</a></div> -<div><a href="cdevcollationattribs.html" title="When you create a Derby database, the attributes that you set determine the collation that is used with all character data in the database.">Database connection URL attributes that control collation</a></div> -<div><a href="cdevcollationexamples.html" title="These examples show the results of sorts on databases created with various collation and locale attributes.">Examples of case-sensitive and case-insensitive string sorting</a></div> -<div><a href="cdevcollationlikeequal.html" title="When you use locale-based collation, the comparisons can return different results when you use the LIKE and equal (=) operators.">Differences between LIKE and equal (=) comparisons</a></div> -</div> -<div class="reltasks"><strong>Related tasks</strong><br /> -<div><a href="tdevdvlpcustomcollation.html" title="You may need to define a collation order different from that of the strengths provided by the collation=collation attribute.">Creating a customized collator</a></div> -<div><a href="tdevdvlpcollation.html" title="By default, Derby uses Unicode codepoint collation. However, you can specify locale-based collation when you create the database.">Creating a database with locale-based collation</a></div> -</div> -</div> - -</body> -</html> +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" lang="en-us" xml:lang="en-us"> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<head> +<meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> +<meta name="copyright" content="(C) Copyright 2005" /> +<meta name="DC.rights.owner" content="(C) Copyright 2005" /> +<meta content="public" name="security" /> +<meta content="index,follow" name="Robots" /> +<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' /> +<meta content="task" name="DC.Type" /> +<meta name="DC.Title" content="Creating a case-insensitive database" /> +<meta name="abstract" content="When you create a database using locale-based collation, the collation=collation value TERRITORY_BASED uses the default collation strength for the locale, usually TERTIARY, which will consider character case significant in searches and comparisons." /> +<meta name="description" content="When you create a database using locale-based collation, the collation=collation value TERRITORY_BASED uses the default collation strength for the locale, usually TERTIARY, which will consider character case significant in searches and comparisons." /> +<meta content="database attributes, case-insensitive collation, collation, case-insensitive" name="DC.subject" /> +<meta content="database attributes, case-insensitive collation, collation, case-insensitive" name="keywords" /> +<meta scheme="URI" name="DC.Relation" content="cdevcollation.html" /> +<meta scheme="URI" name="DC.Relation" content="cdevcollationoverview.html" /> +<meta scheme="URI" name="DC.Relation" content="cdevcollationlocale.html" /> +<meta scheme="URI" name="DC.Relation" content="cdevcollationattribs.html" /> +<meta scheme="URI" name="DC.Relation" content="cdevcollationexamples.html" /> +<meta scheme="URI" name="DC.Relation" content="cdevcollationlikeequal.html" /> +<meta scheme="URI" name="DC.Relation" content="tdevdvlpcustomcollation.html" /> +<meta scheme="URI" name="DC.Relation" content="tdevdvlpcollation.html" /> +<meta scheme="URI" name="DC.Relation" content="cdevdvlp51654.html" /> +<meta content="XHTML" name="DC.Format" /> +<meta content="tdevdvlpcaseinscoll" name="DC.Identifier" /> +<meta content="en-us" name="DC.Language" /> +<link href="commonltr.css" type="text/css" rel="stylesheet" /> +<title>Creating a case-insensitive database</title> +</head> +<body id="tdevdvlpcaseinscoll"><a name="tdevdvlpcaseinscoll"><!-- --></a> + + +<h1 class="topictitle1">Creating a case-insensitive database</h1> + + + +<div><p>When you create a database using locale-based collation, the +<em>collation=collation</em> value TERRITORY_BASED uses the default +collation strength for the locale, usually TERTIARY, which will consider +character case significant in searches and comparisons.</p> + +<div class="section"><p>To make the database use case-insensitive searches, specify an +explicit strength lower than TERTIARY with the <em>collation=collation</em> +attribute. The strength name is appended to TERRITORY_BASED with a colon to +separate them.</p> + +<p>For example, you could specify the following connection URL:</p> + +<pre>jdbc:derby:SwedishDB;create=true;territory=sv_SE;collation=TERRITORY_BASED:PRIMARY</pre> + +<p>With strength PRIMARY, the characters 'A' and 'a' will be considered equal, +as well as 'à ' ('a' with a grave accent). (This behavior is +commonly the default with many other databases.) To make searches +respect differences in accent, use strength SECONDARY.</p> + +<p>The exact interpretation of the strength part of the attribute depends upon +the locale.</p> + +<p>For more information, see +<a href="tdevdvlpcollation.html#tdevdvlpcollation">Creating a database with locale-based collation</a> and the +documentation of the <em>territory=ll_CC</em> and <em>collation=collation</em> +attributes in the <span><em>Derby Reference Manual</em></span>.</p> + +</div> + +</div> + +<div> +<div class="familylinks"> +<div class="parentlink"><strong>Parent topic:</strong> <a href="cdevdvlp51654.html" title="You specify attributes on the Derby connection URL.">Working with the database connection URL attributes</a></div> +</div> +<div class="relconcepts"><strong>Related concepts</strong><br /> +<div><a href="cdevcollation.html" title="A character set is a set of symbols and encodings. Character data types are represented as Unicode 2.0 sequences in Derby. Collation defines how character data is sorted.">Character-based collation in Derby</a></div> +<div><a href="cdevcollationoverview.html" title="Derby supports a wide range of character sets and encodes all of the character sets by using the Unicode support provided by the java.lang.Character class in the Java Virtual Machine (JVM) in which the Derby database runs.">How collation works in Derby</a></div> +<div><a href="cdevcollationlocale.html" title="Derby supports the ability to define collation rules that are appropriate to a locale. This is referred to as locale-based collation.">Locale-based collation</a></div> +<div><a href="cdevcollationattribs.html" title="When you create a Derby database, the attributes that you set determine the collation that is used with all character data in the database.">Database connection URL attributes that control collation</a></div> +<div><a href="cdevcollationexamples.html" title="These examples show the results of sorts on databases created with various collation and locale attributes.">Examples of case-sensitive and case-insensitive string sorting</a></div> +<div><a href="cdevcollationlikeequal.html" title="When you use locale-based collation, the comparisons can return different results when you use the LIKE and equal (=) operators.">Differences between LIKE and equal (=) comparisons</a></div> +</div> +<div class="reltasks"><strong>Related tasks</strong><br /> +<div><a href="tdevdvlpcustomcollation.html" title="You may need to define a collation order different from that of the strengths provided by the collation=collation attribute.">Creating a customized collator</a></div> +<div><a href="tdevdvlpcollation.html" title="By default, Derby uses Unicode codepoint collation. However, you can specify locale-based collation when you create the database.">Creating a database with locale-based collation</a></div> +</div> +</div> + +</body> +</html> Modified: websites/production/db/content/derby/docs/10.10/devguide/tdevdvlpcustomcollation.html ============================================================================== --- websites/production/db/content/derby/docs/10.10/devguide/tdevdvlpcustomcollation.html (original) +++ websites/production/db/content/derby/docs/10.10/devguide/tdevdvlpcustomcollation.html Fri Aug 1 13:16:41 2014 @@ -1,177 +1,177 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" lang="en-us" xml:lang="en-us"> -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<head> -<meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> -<meta name="copyright" content="(C) Copyright 2005" /> -<meta name="DC.rights.owner" content="(C) Copyright 2005" /> -<meta content="public" name="security" /> -<meta content="index,follow" name="Robots" /> -<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' /> -<meta content="task" name="DC.Type" /> -<meta name="DC.Title" content="Creating a customized collator" /> -<meta name="abstract" content="You may need to define a collation order different from that of the strengths provided by the collation=collation attribute." /> -<meta name="description" content="You may need to define a collation order different from that of the strengths provided by the collation=collation attribute." /> -<meta content="customizing collation, collation, customized" name="DC.subject" /> -<meta content="customizing collation, collation, customized" name="keywords" /> -<meta scheme="URI" name="DC.Relation" content="cdevcollation.html" /> -<meta scheme="URI" name="DC.Relation" content="cdevcollationoverview.html" /> -<meta scheme="URI" name="DC.Relation" content="cdevcollationlocale.html" /> -<meta scheme="URI" name="DC.Relation" content="cdevcollationattribs.html" /> -<meta scheme="URI" name="DC.Relation" content="cdevcollationexamples.html" /> -<meta scheme="URI" name="DC.Relation" content="cdevcollationlikeequal.html" /> -<meta scheme="URI" name="DC.Relation" content="tdevdvlpcaseinscoll.html" /> -<meta scheme="URI" name="DC.Relation" content="tdevdvlpcollation.html" /> -<meta scheme="URI" name="DC.Relation" content="cdevdvlp51654.html" /> -<meta content="XHTML" name="DC.Format" /> -<meta content="tdevdvlpcustomcollation" name="DC.Identifier" /> -<meta content="en-us" name="DC.Language" /> -<link href="commonltr.css" type="text/css" rel="stylesheet" /> -<title>Creating a customized collator</title> -</head> -<body id="tdevdvlpcustomcollation"><a name="tdevdvlpcustomcollation"><!-- --></a> - - -<h1 class="topictitle1">Creating a customized collator</h1> - - - -<div><p>You may need to define a collation order different from that of the -strengths provided by the <em>collation=collation</em> attribute.</p> - -<div class="section"> -<p>To define a new collation order, follow these steps.</p> - -</div> - -<ol> -<li> -<span>Create a class that extends the <em>java.text.spi.CollatorProvider</em> -class and that returns a collator that orders strings the way you want it -to.</span> -</li> - -<li> -<span>Create a text file named -<em>META-INF/services/java.text.spi.CollatorProvider</em> that contains one line -with the name of your collator provider class.</span> -</li> - -<li> -<span>Put the compiled class file and the text file in a jar file that you drop -into your JRE's <em>lib/ext</em> directory or in one of the directories specified -by the <em>java.ext.dirs</em> property.</span></li> - -</ol> - -<div class="example"> -<p>For example, suppose you want to define a collation order to make Greek -characters sort near their Latin equivalents ('α' near 'a', ''β' near -'b', and so on). You could define another locale with a <em>CollatorProvider</em> -that returns a <em>java.text.RuleBasedCollator</em> with ever rules you want. -See the API documentation for the <em>RuleBasedCollator</em> class for details -about how you specify rules. In its simplest form, a set of rules might look -like <samp class="codeph">"a,A < b,B < c,C"</samp>, which means more or less that -'a' and 'A' should be sorted before 'b' and 'B', which should be sorted before -'c' and 'C'. So to get the Greek characters sorted near similar Latin -characters, define a <em>CollatorProvider</em> that looks like this one:</p> - -<pre> -public class MyCollatorProvider extends CollatorProvider { - public Locale[] getAvailableLocales() { - return new Locale[] { - new Locale("en", "US", "greek") - }; - } - - public Collator getInstance(Locale locale) { - StringBuilder rules = new StringBuilder(); - // alpha should go between a and b - rules.append("< a,A < \u03b1,\u0391 < b,B"); - // beta should go between b and c - rules.append("& b,B < \u03b2,\u0392 < c,C"); - // add more rules here .... - - try { - return new RuleBasedCollator(rules.toString()); - } catch (ParseException pe) { - throw new Error(pe); - } - } -} -</pre> - -<p>Again, put the compiled class and the -<em>META-INF/services/java.text.spi.CollatorProvider</em> file in a jar file, and -start the <samp class="codeph">ij</samp> tool with the <samp class="codeph">-Djava.ext.dirs=.</samp> -option in the directory where the jar file is located. Create a database that -uses the new locale and insert some data with both Greek and Latin -characters:</p> - -<pre> -ij> connect 'jdbc:derby:GreekDB;territory=en_US_greek;collation=TERRITORY_BASED;create=true'; -ij> create table t (x varchar(12)); -0 rows inserted/updated/deleted -ij> insert into t values 'a', 'b', 'c', 'α', 'β'; -5 rows inserted/updated/deleted -ij> select * from t order by x; -X ------------- -a -α -b -β -c - -5 rows selected -</pre> - -<p>The ordering is just as you wanted it, with the Greek characters between the -Latin ones, and not at the end where they would normally be located.</p> - -<p>One word of caution: If, after you have created a database, you update your -custom <em>CollatorProvider</em> so that the ordering is changed, you will need -to recreate the database. You must do this because the indexes in the database -are ordered, and you may see strange results if the indexes are ordered with a -different collator from the one your database is currently using.</p> - -</div> - -</div> - -<div> -<div class="familylinks"> -<div class="parentlink"><strong>Parent topic:</strong> <a href="cdevdvlp51654.html" title="You specify attributes on the Derby connection URL.">Working with the database connection URL attributes</a></div> -</div> -<div class="relconcepts"><strong>Related concepts</strong><br /> -<div><a href="cdevcollation.html" title="A character set is a set of symbols and encodings. Character data types are represented as Unicode 2.0 sequences in Derby. Collation defines how character data is sorted.">Character-based collation in Derby</a></div> -<div><a href="cdevcollationoverview.html" title="Derby supports a wide range of character sets and encodes all of the character sets by using the Unicode support provided by the java.lang.Character class in the Java Virtual Machine (JVM) in which the Derby database runs.">How collation works in Derby</a></div> -<div><a href="cdevcollationlocale.html" title="Derby supports the ability to define collation rules that are appropriate to a locale. This is referred to as locale-based collation.">Locale-based collation</a></div> -<div><a href="cdevcollationattribs.html" title="When you create a Derby database, the attributes that you set determine the collation that is used with all character data in the database.">Database connection URL attributes that control collation</a></div> -<div><a href="cdevcollationexamples.html" title="These examples show the results of sorts on databases created with various collation and locale attributes.">Examples of case-sensitive and case-insensitive string sorting</a></div> -<div><a href="cdevcollationlikeequal.html" title="When you use locale-based collation, the comparisons can return different results when you use the LIKE and equal (=) operators.">Differences between LIKE and equal (=) comparisons</a></div> -</div> -<div class="reltasks"><strong>Related tasks</strong><br /> -<div><a href="tdevdvlpcaseinscoll.html" title="When you create a database using locale-based collation, the collation=collation value TERRITORY_BASED uses the default collation strength for the locale, usually TERTIARY, which will consider character case significant in searches and comparisons.">Creating a case-insensitive database</a></div> -<div><a href="tdevdvlpcollation.html" title="By default, Derby uses Unicode codepoint collation. However, you can specify locale-based collation when you create the database.">Creating a database with locale-based collation</a></div> -</div> -</div> - -</body> -</html> +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" lang="en-us" xml:lang="en-us"> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<head> +<meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> +<meta name="copyright" content="(C) Copyright 2005" /> +<meta name="DC.rights.owner" content="(C) Copyright 2005" /> +<meta content="public" name="security" /> +<meta content="index,follow" name="Robots" /> +<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' /> +<meta content="task" name="DC.Type" /> +<meta name="DC.Title" content="Creating a customized collator" /> +<meta name="abstract" content="You may need to define a collation order different from that of the strengths provided by the collation=collation attribute." /> +<meta name="description" content="You may need to define a collation order different from that of the strengths provided by the collation=collation attribute." /> +<meta content="customizing collation, collation, customized" name="DC.subject" /> +<meta content="customizing collation, collation, customized" name="keywords" /> +<meta scheme="URI" name="DC.Relation" content="cdevcollation.html" /> +<meta scheme="URI" name="DC.Relation" content="cdevcollationoverview.html" /> +<meta scheme="URI" name="DC.Relation" content="cdevcollationlocale.html" /> +<meta scheme="URI" name="DC.Relation" content="cdevcollationattribs.html" /> +<meta scheme="URI" name="DC.Relation" content="cdevcollationexamples.html" /> +<meta scheme="URI" name="DC.Relation" content="cdevcollationlikeequal.html" /> +<meta scheme="URI" name="DC.Relation" content="tdevdvlpcaseinscoll.html" /> +<meta scheme="URI" name="DC.Relation" content="tdevdvlpcollation.html" /> +<meta scheme="URI" name="DC.Relation" content="cdevdvlp51654.html" /> +<meta content="XHTML" name="DC.Format" /> +<meta content="tdevdvlpcustomcollation" name="DC.Identifier" /> +<meta content="en-us" name="DC.Language" /> +<link href="commonltr.css" type="text/css" rel="stylesheet" /> +<title>Creating a customized collator</title> +</head> +<body id="tdevdvlpcustomcollation"><a name="tdevdvlpcustomcollation"><!-- --></a> + + +<h1 class="topictitle1">Creating a customized collator</h1> + + + +<div><p>You may need to define a collation order different from that of the +strengths provided by the <em>collation=collation</em> attribute.</p> + +<div class="section"> +<p>To define a new collation order, follow these steps.</p> + +</div> + +<ol> +<li> +<span>Create a class that extends the <em>java.text.spi.CollatorProvider</em> +class and that returns a collator that orders strings the way you want it +to.</span> +</li> + +<li> +<span>Create a text file named +<em>META-INF/services/java.text.spi.CollatorProvider</em> that contains one line +with the name of your collator provider class.</span> +</li> + +<li> +<span>Put the compiled class file and the text file in a jar file that you drop +into your JRE's <em>lib/ext</em> directory or in one of the directories specified +by the <em>java.ext.dirs</em> property.</span></li> + +</ol> + +<div class="example"> +<p>For example, suppose you want to define a collation order to make Greek +characters sort near their Latin equivalents ('α' near 'a', ''β' near +'b', and so on). You could define another locale with a <em>CollatorProvider</em> +that returns a <em>java.text.RuleBasedCollator</em> with ever rules you want. +See the API documentation for the <em>RuleBasedCollator</em> class for details +about how you specify rules. In its simplest form, a set of rules might look +like <samp class="codeph">"a,A < b,B < c,C"</samp>, which means more or less that +'a' and 'A' should be sorted before 'b' and 'B', which should be sorted before +'c' and 'C'. So to get the Greek characters sorted near similar Latin +characters, define a <em>CollatorProvider</em> that looks like this one:</p> + +<pre> +public class MyCollatorProvider extends CollatorProvider { + public Locale[] getAvailableLocales() { + return new Locale[] { + new Locale("en", "US", "greek") + }; + } + + public Collator getInstance(Locale locale) { + StringBuilder rules = new StringBuilder(); + // alpha should go between a and b + rules.append("< a,A < \u03b1,\u0391 < b,B"); + // beta should go between b and c + rules.append("& b,B < \u03b2,\u0392 < c,C"); + // add more rules here .... + + try { + return new RuleBasedCollator(rules.toString()); + } catch (ParseException pe) { + throw new Error(pe); + } + } +} +</pre> + +<p>Again, put the compiled class and the +<em>META-INF/services/java.text.spi.CollatorProvider</em> file in a jar file, and +start the <samp class="codeph">ij</samp> tool with the <samp class="codeph">-Djava.ext.dirs=.</samp> +option in the directory where the jar file is located. Create a database that +uses the new locale and insert some data with both Greek and Latin +characters:</p> + +<pre> +ij> connect 'jdbc:derby:GreekDB;territory=en_US_greek;collation=TERRITORY_BASED;create=true'; +ij> create table t (x varchar(12)); +0 rows inserted/updated/deleted +ij> insert into t values 'a', 'b', 'c', 'α', 'β'; +5 rows inserted/updated/deleted +ij> select * from t order by x; +X +------------ +a +α +b +β +c + +5 rows selected +</pre> + +<p>The ordering is just as you wanted it, with the Greek characters between the +Latin ones, and not at the end where they would normally be located.</p> + +<p>One word of caution: If, after you have created a database, you update your +custom <em>CollatorProvider</em> so that the ordering is changed, you will need +to recreate the database. You must do this because the indexes in the database +are ordered, and you may see strange results if the indexes are ordered with a +different collator from the one your database is currently using.</p> + +</div> + +</div> + +<div> +<div class="familylinks"> +<div class="parentlink"><strong>Parent topic:</strong> <a href="cdevdvlp51654.html" title="You specify attributes on the Derby connection URL.">Working with the database connection URL attributes</a></div> +</div> +<div class="relconcepts"><strong>Related concepts</strong><br /> +<div><a href="cdevcollation.html" title="A character set is a set of symbols and encodings. Character data types are represented as Unicode 2.0 sequences in Derby. Collation defines how character data is sorted.">Character-based collation in Derby</a></div> +<div><a href="cdevcollationoverview.html" title="Derby supports a wide range of character sets and encodes all of the character sets by using the Unicode support provided by the java.lang.Character class in the Java Virtual Machine (JVM) in which the Derby database runs.">How collation works in Derby</a></div> +<div><a href="cdevcollationlocale.html" title="Derby supports the ability to define collation rules that are appropriate to a locale. This is referred to as locale-based collation.">Locale-based collation</a></div> +<div><a href="cdevcollationattribs.html" title="When you create a Derby database, the attributes that you set determine the collation that is used with all character data in the database.">Database connection URL attributes that control collation</a></div> +<div><a href="cdevcollationexamples.html" title="These examples show the results of sorts on databases created with various collation and locale attributes.">Examples of case-sensitive and case-insensitive string sorting</a></div> +<div><a href="cdevcollationlikeequal.html" title="When you use locale-based collation, the comparisons can return different results when you use the LIKE and equal (=) operators.">Differences between LIKE and equal (=) comparisons</a></div> +</div> +<div class="reltasks"><strong>Related tasks</strong><br /> +<div><a href="tdevdvlpcaseinscoll.html" title="When you create a database using locale-based collation, the collation=collation value TERRITORY_BASED uses the default collation strength for the locale, usually TERTIARY, which will consider character case significant in searches and comparisons.">Creating a case-insensitive database</a></div> +<div><a href="tdevdvlpcollation.html" title="By default, Derby uses Unicode codepoint collation. However, you can specify locale-based collation when you create the database.">Creating a database with locale-based collation</a></div> +</div> +</div> + +</body> +</html>