Derby is a transactional, relational database written in pure Java, taking up only a small amount of disk space. Derby originated in Cloudscape, which was a product that IBM acquired from Informix. In 2004, IBM decided to cloudscape open the source code, making it the incubator project under Apachesoftwarefoundation, which is named Derby. The real benefit of using Derby is that it requires minimal management and a small resource footprint. The database on the disk is relatively small and is about 2MB for the base database. The least-managed fact allows developers to easily create and use databases in code. This accelerates the development. Because Derby supports the storage of databases that are archived in jar files, this allows you to simply distribute jar files so that deployment becomes so easy.
Learn about derby history and now see how the installation uses
Derby Official Home: http://db.apache.org/derby/index.html
Derby download page: http://db.apache.org/derby/derby_downloads.html
To install Derby, you must first download the latest version of the ZIP or tar package from Derby's website. The current latest version is Db-derby-10.5.1.1-bin.
Releases are:
--The binary distribution includes code, sample programs, and documentation. The optimized jar document is in the Lib directory
The--lib release includes the optimizer, which deploys a collection of the smallest jars of Derby.
The--lib-debug release includes a useful maximum set for debugging Derby and reporting problems.
The--SRC release includes source files to produce the three distributions above.
Install Derby, just unzip the package file you downloaded to the directory you specified.
Suppose you are downloading a binary release.
Unzip the downloaded package and then have the following subdirectories:
--demo included the sample program
--bin includes code to run and set up the environment
--javadoc includes an AIP document with source code production
--doc includes the Derby documentation
--lib includes the jar file for Derby
There are several ways to configure Derby, as described in the Derby manual:
1. Run the appropriate tools for installing directory lib through the Java command.
2. By running the script command provided by Derby. First configure the PATH environment variable to point to the bin directory in the Derby directory, and then run the related batch command within the Bin directory.
3. By running the Derbyrun.jar archive in the installation directory lib.
Running Derby by hand through the Java command is cumbersome and inconvenient to use.
With the following simple steps, we can complete the Enable Derby
1. Export DERBY_HOME=/OPT/DERBY_10
2. Export path= "$DERBY _home/bin: $PATH"
3. mkdir $DERBY _home/derbytutor
4. CP $DERBY _home/demo/programs/toursdb/*.sql $DERBY _home/derbytutor
To run the database:
Java-jar $DERBY _home/lib/derbyrun.jar IJ
Then run the CREATE database TestDB:
Ij>connect ' jdbc:derby:testdb;create=true ';
Create=true is specified above, a new database is created.
To connect to this database:
Ij> Connect ' jdbc:derby:testdb; ';
IJ (CONNECTION1) >
At this point, you can run the corresponding SQL statements, database operations. This step is a single user embedded database operation.
Let Derby run in Server mode:
To start the server:
Java-jar $DERBY _home/lib/derbyrun.jar Server start
To shut down the server:
Java-jar $DERBY _home/lib/derbyrun.jar Server shutdown
References: http://db.apache.org/derby/docs/10.5/getstart/getstart-single.html#rgslib46043 http://hi.baidu.com/7636553 /item/4cbdf4289ba711c7ee10f137
From: