Derby
From APIDesign
Line 1: | Line 1: | ||
- | [[wikipedia:Apache_Derby|Derby]] (also known as [[Java]] DB) is a lightweight, embeddable [[SQL]] database. It is very useful while running tests. I | + | [[wikipedia:Apache_Derby|Derby]] (also known as [[Java]] DB) is a lightweight, embeddable [[SQL]] database. It is very useful while running tests. I decided to use it to demonstrate functionality of the [[LiveDB]] project. |
It took me about two days to find out how to configure the [[Derby]] database through [[Ant]] build script. I wanted the [[Ant]] script to start the database, create there a table, fill it with some sample data and then compile and execute associated unit tests. For a while I was oscillating between using embedded driver vs. starting the server and connecting to it via socket. At the end the embedded driver turned to be easier to use: | It took me about two days to find out how to configure the [[Derby]] database through [[Ant]] build script. I wanted the [[Ant]] script to start the database, create there a table, fill it with some sample data and then compile and execute associated unit tests. For a while I was oscillating between using embedded driver vs. starting the server and connecting to it via socket. At the end the embedded driver turned to be easier to use: |
Revision as of 07:19, 17 July 2010
Derby (also known as Java DB) is a lightweight, embeddable SQL database. It is very useful while running tests. I decided to use it to demonstrate functionality of the LiveDB project.
It took me about two days to find out how to configure the Derby database through Ant build script. I wanted the Ant script to start the database, create there a table, fill it with some sample data and then compile and execute associated unit tests. For a while I was oscillating between using embedded driver vs. starting the server and connecting to it via socket. At the end the embedded driver turned to be easier to use:
does not exists: livedb.derby.create
The last problem that I had to face was inconsistent state of a database. To eliminate that, you need to close the shut the database down. As far as I can tell this cannot be done in Ant (version 1.8.1) without having an <sql> target that fails and print a nasty warning. However even this is easier than writing own Ant task (as suggested elsewhere on the blogosphere).
I could not google out any sufficient how to, thus I am writing this one. I hope it will be useful for those who want to merge Ant and Derby database.
<comments/>