Java Reference
In-Depth Information
DBcreatesa
log
directorytostoretransactionlogs,a
seg0
directorytostorethedata
files, and a
service.properties
file to store configuration parameters.
Note
JavaDBdoesn'tprovideanSQLcommandtodrop(destroy)adatabase.Des-
troying a database requires that you manually delete its directory structure.
Java DB Installation and Configuration
WhenyouinstallJDK7withthedefaultsettings,thebundledJavaDBisinstalledinto
%JAVA_HOME%\db
onWindowsplatforms,orintothe
db
subdirectoryintheequival-
entlocationonUnix/Linuxplatforms.(Forconvenience,IadopttheWindowsconven-
tion when presenting environment variable paths.)
Note
IfocusonJavaDB10.8.1.2inthischapterbecauseit'sincludedwithJDK7
build 1.7.0-b147, which is the Java build on which this topic is based.
The
db
directory contains five files and the following pair of subdirectories:
• The
bin
directory contains scripts for setting up embedded and client/server
environments, running command-line tools, and starting/stopping the network
server.Youshouldaddthisdirectorytoyour
PATH
environmentvariablesothat
you can conveniently execute its scripts from anywhere in the filesystem.
• The
lib
directory contains various JAR files that house the engine library
(
derby.jar
), the command-line tools libraries (
derbytools.jar
and
derbyrun.jar
),thenetworkserverlibrary(
derbynet.jar
),thenetwork
clientlibrary(
derbyclient.jar
),andvariouslocalelibraries.Thisdirect-
ory also contains
derby.war
, which is used to register the network server's
servlet at the
/derbynet
relative path—it's also possible to manage the
Java DB network server remotely via the servlet interface (see
ht-
Additionally, the
%JAVA_HOME%\demo\db
directory contains various Java DB
demos.
Before you can run the tools and demos, and start/stop the network server, you
must set the
DERBY_HOME
environment variable. Set this variable for Windows via
set DERBY_HOME=%JAVA_HOME%\db
, and for Unix (Korn shell) via
export
DERBY_HOME=$JAVA_HOME/db
.