Sunday, July 12, 2015

Apache Derby

Apache Derby:

What is Apache Derby?
  • Relational database management being developed by Apache Software Foundation. 
History:
  • Was initially developed by the Developers of Cloudscape.
  • Informix later acquired Cloudscape. Acquisition continued. IBM acquired Informix and still extended its support for Derby.
  • Time Progressed. IBM later withdrew its support and Apache Software Foundation continued the development of Apache Derby.

Features of Apache Derby:


Max DB Size                      Unlimited

Max Table Size                  Unlimited
Max Row Size                    Unlimited
Max Columns per row      1012
Max Column Name Size   128 bits

When Apache Derby?

  • Apache Derby being written in Java and thus usable only by Java and other scripting languages(Jython, JRuby, Jacl, etc)  that run on JVM.
  • Consumes less Footprint and can be opted when we look for DB that can set quickly.
Installation of Apache Derby:
      In Windows:
                 >> Set the environment variable DERBY_HOME to the Derby installation directory
                 >> Add DERBY_HOME/bin to the "path" environment variable

       In Mac:
               >>Open the Terminal and hit vi ~/.bash_profile 
               >>Now enter the below set of values
                     export DERBY_HOME=/Volumes/D Drive/Softwares/db-derby-10.11.1.1-bin
                     export PATH=$PATH:$DERBY_HOME/bin

Check the Installation    

To check if Derby has been successfully installed, run the following command where /User/hspadmin... is the location of derbyrun.jar residing within lib directory

java -jar /Users/hspadmin/Applications/db-derby-10.11.1.1-bin/lib/derbyrun.jar sysinfo


Once run, you should get the below output:

------------------ Java Information ------------------
Java Version:    1.7.0_75
Java Vendor:     Oracle Corporation
Java home:       /Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home/jre
Java classpath:  /Users/hspadmin/Applications/db-derby-10.11.1.1-bin/lib/derbyrun.jar
OS name:         Mac OS X
OS architecture: x86_64
OS version:      10.9.5
Java user name:  hspadmin
Java user home:  /Users/hspadmin
Java user dir:   /Users/hspadmin
java.specification.name: Java Platform API Specification
java.specification.version: 1.7
java.runtime.version: 1.7.0_75-b13
--------- Derby Information --------
[/Users/hspadmin/Applications/db-derby-10.11.1.1-bin/lib/derby.jar] 10.11.1.1 - (1616546)
[/Users/hspadmin/Applications/db-derby-10.11.1.1-bin/lib/derbytools.jar] 10.11.1.1 - (1616546)
[/Users/hspadmin/Applications/db-derby-10.11.1.1-bin/lib/derbynet.jar] 10.11.1.1 - (1616546)
[/Users/hspadmin/Applications/db-derby-10.11.1.1-bin/lib/derbyclient.jar] 10.11.1.1 - (1616546)
[/Users/hspadmin/Applications/db-derby-10.11.1.1-bin/lib/derbyoptionaltools.jar] 10.11.1.1 - (1616546)
------------------------------------------------------

Command to Start the Derby Server

            startNetworkServer

Change the Port of Derby Server

     By default Derby Server runs on the port 1527 and we can change the default port by the below command:

           startNetworkServer -p 3301

Accept of Connections from specific host:

   By default Derby accepts connections only from localhost and to make it accept the request from other hosts, run the below command with ip address/ domain name

         startNetworkServer -h  testserver.testdomain.com

Accept of Connections from all Host:

         startNetworkServer -h  0.0.0.0

View the Contents of the Database:

Apache Derby doesnot provide any provision for Graphical view of the DB Contents. 
We normally use the Tools IJ / Squirrel SQL Client for this Purpose.


No comments:

Post a Comment