//java architect /
the Unicode code points. Although
this is fine in many cases, it does not
necessarily result in the same ordering
as you would expect in a phone book or
dictionary. For example, an uppercase
letter is not sorted close to its corresponding lowercase variant, and punctuation characters are considered to
be significant.
In JDK 7, Java DB can also order character strings by using the collation rules
defined for specific locales, so-called
language-based ordering. These rules
typically resemble more closely what you
would find in a phone book.
Language-based ordering has to be
enabled using connection attributes
when the database is created. To create
a database that obeys the collation rules
of the en_US locale, you can use the following URL:
language-based ordering (on the right).
Notice that all the names that start
with capital letters are sorted before the
names that start with lowercase letters
in the default ordering, whereas they are
interleaved in between the other words,
in alphabetical order, with the language-based ordering.
COMMUNITY
jdbc:derby:memory:MyDB;create=true
More or less, everything you can do
with an ordinary database can be done
with an in-memory database, including taking a backup of it and restoring it.
This allows you to dump the database to
disk before you shut down your application, reload it into memory the next time
you start the application, or even turn it
into an ordinary on-disk database.
JAVA IN ACTION
GIVE BACK!
ADOPT A JSR
Find your JSR here
jdbc:derby:db;create=true;
territory=en_US;
collation=TERRITORY_BASED
ABOUT US
Table 1 shows how a set of strings
would be ordered by Java DB with
default ordering (on the left) and with
Table 1
DEFAULT ORDERING
VANDERBILT
WOOLF
DA VINCI
VAN BEE THOVEN
VAN GOGH
VON GOE THE
LANGUAGE-BASED ORDERING
DA VINCI
VAN BEE THOVEN
VANDERBILT
VAN GOGH
VON GOETHE
WOOLF
Performance Enhancements
Many performance enhancements have
gone into Java DB between JDK 6 and
JDK 7. The code paths of many common operations have been optimized so
that fewer CPU cycles are spent when
performing queries. Also, some
performance-critical modules have
been rewritten to use collection classes
from the
java.util.concurrent package,
blog
42
ORACLE.COM/JAVAMAGAZINE /////////////////////////////////////////////// MAY/JUNE 2012