Activity 1: Run SQL using the Embedded driver
In this section the Derby database engine is loaded by the Derby
IJ tool. The Derby embedded driver is used to create and connect to the database
firstdb. A few basic SQL commands are demonstrated.
In preparation for performing this activity the environment variable DERBY_HOME
to be set and an empty working directory (DERBYDBS
variable defines the filesystem path to
the root directory of the Derby installation. The DERBYDBS
is where the files created during the activities are stored.
commands defining DERBY_HOME use the fictitious filesystem
paths C:\derby for Windows examples and /opt/derby for
UNIX examples. Be sure to adjust these commands so DERBY_HOME indicates
the location of the Derby installation on the system being used. The following
activity sequence shows
- Setting the DERBY_HOME environment variable.
- Creating the DERBYDBS work directory
- Changing the directory (cd) to the work
- Copying the SQL scripts that create the tables and data for toursdb
from the Derby demo\programs\toursdb subdirectory into the DERBYDBS directory.
Open a command window and perform the following activity sequence:
- On Windows platforms:
copy %DERBY_HOME%\demo\programs\toursdb\*.sql .
- On UNIX Korn Shell platforms:
cp $DERBY_HOME/demo/programs/toursdb/*.sql .
Important: A command prompt will be displayed after
each command is executed. If an error is displayed please double check the
spelling and reenter the command.