Skip Headers
Oracle® Java Embedded Suite Application Developer's Guide
Release 7.0
E28526-01
  Go To Table Of Contents
Contents

Previous
Previous
 
Next
Next
 

5 Working with Java DB

This chapter describes the Oracle Java Embedded Suite's Java DB component.

Table of Contents

5.1 Java DB Features

The edition of Java DB included in Oracle Java Embedded Suite has all Java DB features except those that relate to Java DB's client/server environment. Client/server mode is not supported by the Java DB software included in Oracle Java Embedded Suite. The Java DB code is a library (derby.jar) that the JRE loads with the application.

5.2 Java DB Files

The Java DB files are in installDir/jes7.0/javadb/.

5.2.1 JAR Files

The following files are in the javadb/lib/ directory:

  • derby.jar: Always required on the compile and runtime classpaths

  • derbytools.jar: Required on the compile and runtime classpaths if your application uses the Java DB tools described in Section 5.2.2

5.2.2 Binary Files

The following files are in the javadb/bin/ directory:

  • dblook: Displays the schema of a database.

  • ij: Runs scripts or interactive queries against a database.

  • setEmbeddedCP: Adds the derby.jar and derbytools.jar files to the classpath.

  • sysinfo: Displays information about Java DB and the Java environment.

5.2.3 Obtaining Localized Error Message Files

If you want to present Java DB error messages to device end users, you can obtain non-English localizations of the messages from the Apache Derby ${javaDBversion} download page, where ${javaDBversion} is the Java DB version obtained from the Oracle Java Embedded Suite Release Notes.

The Apache Derby download page can be reached from http://db.apache.org/derby/derby_downloads.html. Download and unzip db-derby-${javaDBversion}-lib.zip, then look for the localization you need in db-derby-${javaDBversion}-lib/lib. Each localization is a JAR file named derbyLocale_${locale}.jar where ${locale} is a supported language. Add the localization JAR file into your classpath.

5.3 Java DB Documentation

The Java DB documentation page is http://docs.oracle.com/javadb/. The Oracle Java Embedded Suite Release Notes give the relevant Java DB version number.

All Java DB documentation topics are relevant in the context of Oracle Java Embedded Suite, except for those related to the Java DB client/server environment. On an embedded device, the database and application run in the same JVM. Java DB uses the term "embedded environment" for the self-contained operation supported by Oracle Java Embedded Suite's Java DB component.

Here is a brief guide to the Java DB documents:

5.4 Java DB Samples

The following samples incorporate Java DB:

5.5 Java DB Notes

For best performance, pre-create databases and save them as JAR files. Creating a database on the fly is an expensive operation that can introduce user-observable delays in an application. The hellostorage sample (Section 8.4) is an example. The first invocation, which creates the database, takes much longer than subsequent runs, which update the existing database.