Project

General

Profile

How to run Java DB Derby » History » Version 5

Udo Offermann, 22.09.2012 13:38

1 1 Henning Blohm
h2. Running a Java DB Network Server
2
3 5 Udo Offermann
In samples we use the Java DB, i.e. the SQL database implementation that comes with the Java SE Development Kit (JDK) by Oracle (except for Mac OS in which case you have to use Apache Derby). Java DB is essentially the same as the "Apache Derby DB":http://db.apache.org/derby/ plus, an installation how-to can be found here: http://db.apache.org/derby/papers/DerbyTut/install_software.html#derby_download.
4 1 Henning Blohm
5 3 Henning Blohm
The instructions below apply to Java DB. Derby can be used similarly.
6
7
For general information on Java DB go to http://docs.oracle.com/javadb/10.8.2.2/getstart/index.html
8 1 Henning Blohm
9
To run the Java DB in server mode, which is what we want to do, run
10
11
<pre><code class="ruby">
12
mkdir derby
13
cd derby
14
java -jar $JAVA_HOME/db/lib/derbyrun.jar server start
15
</code></pre>
16
17
assuming you want to run it in the folder *derby*. At a second time you can omit the "mkdir" command of course. The environment variable JAVA_HOME is expected to point to your JDK installation folder.
18
19
On Windows run
20
21
<pre><code class="ruby">
22
mkdir derby
23
cd derby
24
java -jar %JAVA_HOME%\db\lib\derbyrun.jar server start
25
</code></pre>
26
27 2 Henning Blohm
In order to interactively query Java DB, we recommand to use the Data Source Explorer view in Eclipse. But any SQL client that can make use of JDBC drivers should be fine. The driver for Java DB can be found (at the time of this writing) in *$JAVA_HOME/db/lib/derbyclient.jar* (and similarly on Windows).