How to run Java DB Derby » History » Version 24
Udo Offermann, 03.04.2013 22:43
1 | 1 | Henning Blohm | h2. Running a Java DB Network Server |
---|---|---|---|
2 | |||
3 | 14 | 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 the same as the "Apache Derby DB":http://db.apache.org/derby - see also the "installation how-to":http://db.apache.org/derby/papers/DerbyTut/install_software.html. |
4 | 1 | Henning Blohm | |
5 | 8 | Henning Blohm | The instructions below apply to both, there is only a difference in the installation path. |
6 | 3 | Henning Blohm | |
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 | 10 | Udo Offermann | 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. When you installed Apache Derby and followed the instructions mentioned above, you have to replace $JAVA_HOME by $DERBY_HOME. |
18 | 1 | Henning Blohm | |
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 | 16 | Udo Offermann | In order to interactively query Java DB, we recommend 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). |
28 | 15 | Udo Offermann | |
29 | 23 | Udo Offermann | h2. Alternative: Using the DB-Worker Node Add-on (no separate RDBMS installation required) |
30 | 1 | Henning Blohm | |
31 | 18 | Udo Offermann | you can also use the new [[DB_Worker_Node_Add-on|DB Worker Node Add-on]] which bundles the z2-Environment together with Apache Derby RDBMS inside one setup, so you don't need to install any extra database software. |
32 | 1 | Henning Blohm | |
33 | 19 | Udo Offermann | *How to change the samples to use the DB Worker node?* |
34 | 16 | Udo Offermann | |
35 | 23 | Udo Offermann | You have to add the DB Worker Node Add-on to your samples environment and tell the server to start the DB worker node beside the web worker. |
36 | 20 | Udo Offermann | For this you can use the two files attached to this page: |
37 | 16 | Udo Offermann | |
38 | 24 | Udo Offermann | * *"dbWorkerAddon.properties":http://redmine.z2-environment.net/attachments/download/62/dbWorkerAddon.properties* - points to the z2 component repository containing the DB Worker Node Add-on |
39 | 20 | Udo Offermann | * *home.properties* - a slightly changed _home layout_ that launches the DB worker in addition to the web worker |
40 | 16 | Udo Offermann | |
41 | 22 | Udo Offermann | Just download these two files and put them under @.../install/z2-samples.XYZ/environment/@ - where @z2.samples.XYZ@ must be replaced by the concrete sample name like @z2-samples.spring-hibernate@ |
42 | 16 | Udo Offermann | |
43 |