User Guide - Derby


Applicable Plans: Standard Plus VPS, Standard Max VPS, all Advanced VPS, all Premier VPS (CentOS 5 plans)

Derby is an open source Java relational database. Derby has a very small footprint of about 2 megabytes for both the base and embedded JDBC driver.

Requirements

Derby must be installed in your VPS subscription. This can be done by selecting it when you order the eApps VPS hosting service or by installing it using the Control Panel after the service has been provisioned. To see if Derby is already installed log in to your Control Panel and click on the All Applications icon. If it is not in the installed list, you can install it by clicking on the Add Application icon from the System tab and selecting Apache-Derby then clicking Next.

Configuration Files and Directories


Derby is installed in /usr/share/derby. There are symlinks in /usr/bin that points to the Derby scripts in /usr/share/derby/bin.

Using Derby

Derby can be used in two modes. Embedded Derby and Derby Network Server. In embedded mode Derby runs inside the same Java Virtual Machine (JVM) as the application using it. There is no server process  to start or stop. The network server approach is similar to the more standard client/server approach allowing application running on different JVMs  or remotely to access a Derby database. The Derby jar files must be include in your CLASSPATH in either mode for your application to be able to connect to Derby.  GlassFish users please see the GlassFish User Guide for details on controlling Derby with the GlassFish asadmin tool.

Adding Derby jar files to the eApps provided Tomcat and JBoss CLASSPATH

Using a text editor of your choice edit /etc/tomcatX/tomcat.conf or /etc/jbossX/jboss.conf and add the lines below to the Java Classpath section of the file, save the file and restart the Tomcat or Jboss service.

wrapper.java.classpath.x=/usr/share/derby/lib/derby.jar
wrapper.java.classpath.x=/usr/share/derby/lib/derbytools.jar
wrapper.java.classpath.x=/usr/share/derby/lib/derbyclient.jar

Note: replace x above with a number that represents the position of each line in the classpath list.

Starting and Stopping Derby in Network Server Mode

When Derby is installed there is a user created in the system called derby. If you choose to run Derby in network server mode for security reasons we advise you to run it as the derby user.

su - derby

-bash-3.1# su - derby
-bash-3.1$ whoami
derby
-bash-3.1$ startNetworkServer &
[1] 20214
-bash-3.1$ Security manager installed using the Basic server security policy.
Apache Derby Network Server - 10.3.2.1 - (599110) started and ready to accept connections on port 1527 at 2008-04-15 03:59:13.827 GMT

-bash-3.1# su - derby
-bash-3.1$ stopNetworkServer 
Apache Derby Network Server - 10.3.2.1 - (599110) shutdown at 2008-04-15 04:00:59.642 GMT
Apache Derby Network Server - 10.3.2.1 - (599110) shutdown at 2008-04-15 04:00:59.739 GMT


Resources

Derby Quick Start: http://db.apache.org/derby/quick_start.html
Derby Documentation: http://db.apache.org/derby/manuals/

Comments

Please login to comment