|
RHS |
Creating a database in Java DB
In the following it is assumed that you have installed the Java DB and set up environmental variables as described in the instruction found here: Installing Java DB
This instruction is inspired by the "Getting Started with Java DB" manual which is part of the documentation installed together with the DBMS.
To have the Java DB running as a server click the "Start" button, chose "Run", enter "cmd" and click "OK".
In the command line box enter "java -jar "%DERBY_HOME%/lib/derbyrun.jar" server start" - note the double quotes surrounding the path and jar-filename in case your path contains space (as in "program files"). You should see a message like this: "Security manager installed using the Basic server security policy.
Apache Derby Network Server - 10.3.1.4 - (561794) started and ready to accept connections on port 1527 at 2007-10-01 06:20:18.475 GMT"
To use the tool - ij - for manipulating the database we'll start another command line box: click the "Start" button, chose "Run", enter "ij" and click "OK".
You should see the prompt: "ij>"
The following commands creates (and connects to) a database representing the Story class used in the Blog Xx exercises. Then some data is inserted and finally the "Select" SQL-command is used to test the result. Output from the Java DB is omitted but should be self-explaining :)
Please note the an ij command ends with a semicolon.
Also note that the output from the Java DB looks "ugly" as the type of all values are relatively long varchars - it should of course be formatted.
To shut down the JAVA DB server enter "java -jar "%DERBY_HOME%/lib/derbyrun.jar" server shutdown;"
To exit ij enter "Exit;"
In the first command line box the server should now shudown.