Note: MyEclipse comes with Derby included as an integrated test database. There is no need to do anything to configure this sandbox version, though there are associated preferences. If you want a simple database on which to test, use this embedded version of Derby (there is a Derby Database Server Tutorial, in the workbench help). Otherwise, you may install an external version and follow this guide.
Apache Derby is a great Java-based multi-use database, along with HSQLDB. Both of these databases can be set to run in-memory (embedded) or as a service like a more typical DBMS install. This tip will cover how to install and run Derby in-memory.
This is extremely helpful when testing an application and you need a temporary DB to run all your tests against.
Installing Apache Derby
1) Go here for the latest stable Derby release and download the BIN ZIP file.
2) After downloading it, unzip the file to some location (it will create a db-derby-<VERSION>-bin subdirectory)
Believe it or not, now we are done with the installation. Since the DB is going to run in-memory, just making “connect” calls via the embedded JDBC driver will actually create the DB for us, we don’t need to do any more installing or initialization.
Connecting to Apache Derby
These instructions look long, but they are very straight forward and most of them you only need to do once…
In MyEclipse, switch to the “MyEclipse Database Explorer” perspective:
Click the “New” menu item in the DB Browser view:
Fill in the fields as shown in the screenshot below
In the “Driver JARs” panel, click “Add JARs…”
Find your derby.jar file in the /lib directory under the derby directory we unzipped from the section above.
Use the “Driver classname” drop-down box to select the org.apache.derby.jdbc.EmbeddedDriver class:
Now you can select the Embedded Derby connection and hit the “Open Connection” button to connect to your Derby DB.
Note:Any created database will be created as a folder with the same name in the MyEclipse installation folder (for the example above, this would be “derbyDB”). To setup Derby as a normal server service, please see the Derby Documentation.
This topic was modified 1 month, 2 weeks ago by support-tony.
Viewing 1 post (of 1 total)
The topic ‘[DB] How do I install and connect to Apache Derby?’ is closed to new replies.