How to use an external database?

Supported databases

  • Derby
  • MySQL
  • Postgres
  • MS SQL Server (with modifications)
  • Oracle (with modifications)

Configure Continuum

There is some information in the installation guides for the standalone Continuum installation and the Continuum web application deployed to Tomcat.

Standalone version

To use an external database with Continuum standalone, you must configure DataSources in $CONTINUUM_HOME/contexts/continuum.xml

  <!-- continuum database -->

  <New id="continuum" class="org.eclipse.jetty.plus.jndi.Resource">
    <Arg><Ref id="wac"/></Arg>
    <Arg>jdbc/continuum</Arg>
    <Arg>
      <New class="org.apache.commons.dbcp.BasicDataSource">
        <Set name="driverClassName">org.apache.derby.jdbc.EmbeddedDriver</Set>
        <Set name="url">jdbc:derby:<Property name="appserver.base" default="."/>/data/databases/continuum;create=true</Set>
        <Set name="username">SA</Set>
        <Set name="password"></Set>
        <Set name="testOnBorrow">true</Set>
        <Set name="validationQuery">SELECT count(*) FROM SYS.SYSTABLES</Set>
      </New>
    </Arg>
  </New>

  <!-- Users / Security Database -->

  <New id="users" class="org.eclipse.jetty.plus.jndi.Resource">
    <Arg><Ref id="wac"/></Arg>
    <Arg>jdbc/users</Arg>
    <Arg>
      <New class="org.apache.commons.dbcp.BasicDataSource">
        <Set name="driverClassName">org.apache.derby.jdbc.EmbeddedDriver</Set>
        <Set name="url">jdbc:derby:<Property name="appserver.base" default="."/>/data/databases/users;create=true</Set>
        <Set name="username">SA</Set>
        <Set name="password"></Set>
        <Set name="testOnBorrow">true</Set>
        <Set name="validationQuery">SELECT count(*) FROM SYS.SYSTABLES</Set>
      </New>
    </Arg>
  </New>

In addition, you must add the JDBC driver to the $CONTINUUM_HOME/lib directory, and update $CONTINUUM_HOME/conf/wrapper.conf to list the driver instead of Derby. For example:

wrapper.java.classpath.15=%REPO_DIR%/postgresql-8.4-702.jdbc3.jar

If you use MS SQL Server or Oracle, you will need to adjust the $CONTINUUM_HOME/apps/continuum/WEB-INF/classes/META-INF/plexus/application.xml file to change the javax.jdo.option.Mapping value from default to mssql or oracle respectively. Bear in mind that this change will need to be made again across release upgrades.

<otherProperties>
  <property>
    <name>javax.jdo.option.Mapping</name>
    <value>default</value>
    <!-- change this property for SQL Server or Oracle support - CONTINUUM-697 -->
    <!-- value>mssql</value -->
    <!-- value>oracle</value -->
  </property>

Web Application

To use an external database with the Continuum web application, you should configure the DataSource in your container.

Make sure the JDBC driver is available in the expected location for your container.

If you use MS SQL Server or Oracle, you will need to adjust the WEB-INF/classes/META-INF/plexus/application.xml file in the unpacked web application to change the javax.jdo.option.Mapping value from default to mssql or oracle respectively. Bear in mind that this change will need to be made again across release upgrades.

<otherProperties>
  <property>
    <name>javax.jdo.option.Mapping</name>
    <value>default</value>
    <!-- change this property for SQL Server or Oracle support - CONTINUUM-697 -->
    <!-- value>mssql</value -->
    <!-- value>oracle</value -->
  </property>

Shutdown Procedure

When using an external database, it is very important to stop Continuum prior to stopping or restarting the database. Continuum may exhibit unpredictable behavior if the database disappears while it is running, and may not recover once the database comes back up. If this happens, you must re-start Continuum.