Docs‎ > ‎Apache Tomcat‎ > ‎

Apache Derby as admin database

Since build 1787 (September 19, 2015), it is possible to use Apache Derby instead of MySQL as an admin database. This page explains how.

Limitations

Using Apache Derby is currently supported only in the embedded mode -- server mode is not supported, due to some limitations of Apache Derby.
This means that using Apache Derby cannot support cluster configurations. Only one server can access the database at any one time.

Details

Install as per the war file instructions, with the following additional steps.

In the Tomcat file %CATALINA_HOME%/conf/server.xml, you need to add the following entry to the <GlobalNamingResources> section:

<Resource 
  accessToUnderlyingConnectionAllowed="true"
  auth="Container"
  defaultAutoCommit="false"
  driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
  initialSize="0"
  logAbandoned="true"
  maxActive="10"
  maxIdle="0"
  maxWait="15000"
  minIdle="0"
  name="jdbc/AdminDB"
  removeAbandoned="true"
  removeAbandonedTimeout="30"
  timeBetweenEvictionRunsMillis="30000"
  type="javax.sql.DataSource"
  url="jdbc:derby:/Users/jdoe/CALiveAPICreatorAdmin;create=true"
  username="CALiveAPICreatorAdmin"/>


The items in bold are the ones that are required -- you can modify other parameters as desired.  The url parameter must point to either the directory for an existing Derby database, or a non-existing directory which will be created.

If you have a port conflict with the default 8080 - locate the start.ini in the home folder and change the snippet:

## Connector port to listen on

jetty.http.port=8080

Obviously, you can specify any path in the URL. On Windows, you can specify a drive, e.g. jdbc:derby:d:\Users\jdoe\CALiveAPICreator;create=true -- see full details for the JavaDB URL

Note that the create=true parameter will create a new database directory if one does not exist -- this is usually desirable, at least for the first time.