Database Configuration

This page is for tracking the changes required to get various databases working with continuum.

NOTE Latest info is now at Apache Continuum Documentation

See Jetty JNDI and Jetty Data Source examples

Steps (tested in Jetty 6.1.9 and PostgreSQL 8.3)

  • Copy the jdbc driver to JETTY_HOME/lib folder
  • Add the continuum JNDI datasource entry to JETTY_HOME/etc/jetty-plus.xml
    jetty-plus.xml
    <New id="continuumDataSource" class="org.postgresql.ds.PGPoolingDataSource">
          <Set name="serverName">localhost</Set>
          <Set name="databaseName">continuum</Set>
          <Set name="user">continuum</Set>
          <Set name="password">continuum</Set>
        </New>
        <New id="continuum" class="org.mortbay.jetty.plus.naming.Resource">
          <Arg>jdbc/continuum</Arg>
          <Arg><Ref id="continuumDataSource"/></Arg>
        </New>
        <New id="users" class="org.mortbay.jetty.plus.naming.Resource">
          <Arg>jdbc/users</Arg>
          <Arg><Ref id="continuumDataSource"/></Arg>
        </New>
  • Uncomment the addLifeCycle call in JETTY_HOME/etc/jetty-plus.xml
    jetty-plus.xml
    <Call name="addLifeCycle">
          <Arg>
            <New class="org.mortbay.jetty.deployer.WebAppDeployer">
              <Set name="contexts"><Ref id="Contexts"/></Set>
              <Set name="webAppDir"><SystemProperty name="jetty.home" default="."/>/webapps-plus</Set>
              <Set name="parentLoaderPriority">false</Set>
              <Set name="extract">true</Set>
              <Set name="allowDuplicates">false</Set>
              <Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set>
              <Set name="configurationClasses"><Ref id="plusConfig"/></Set>
            </New>
          </Arg>
        </Call>
  • Deploy the war to JETTY_HOME/webapps-plus (instead of JETTY_HOME/webapps)
  • Start Jetty with
    java -jar start.jar etc/jetty.xml etc/jetty-plus.xml

Antoher option (haven't tested it) is to copy the jdbc jar to continuum webapp WEB-INF/lib and putting the configuration in continuum webapp WEB-INF/jetty-env.xml

Postgres

You can get JDBC drivers from the repo under postgresql:postgresql

dependency
<dependency>
      <groupId>postgresql</groupId>
      <artifactId>postgresql</artifactId>
      <version>8.3-603.jdbc4</version>
    </dependency>

Follow steps above

derby external

jetty-env.xml
<New id="continuum" class="org.mortbay.jetty.plus.naming.Resource">
  <Arg>jdbc/continuum</Arg>
  <Arg>
    <New class="org.apache.derby.jdbc.ClientDataSource">
      <Set name="serverName">localhost</Set>
      <Set name="portNumber">1527</Set>
      <Set name="databaseName">continuum;create=true</Set>
      <Set name="user">sa</Set>
    </New>
  </Arg>
</New>
<New id="users" class="org.mortbay.jetty.plus.naming.Resource">
  <Arg>jdbc/users</Arg>
  <Arg>
    <New class="org.apache.derby.jdbc.ClientDataSource">
      <Set name="serverName">localhost</Set>
      <Set name="portNumber">1527</Set>
      <Set name="databaseName">users;create=true</Set>
      <Set name="user">sa</Set>
    </New>
  </Arg>
</New>

Connecting to internal database via ant

A user contributed this approach to connecting to an internally managed derby database in issue http://jira.codehaus.org/browse/CONTINUUM-932

ant project
<project default="connectDB">
	<target name="connectDB" description="attach to the embedded derby database">
	<java classname="org.apache.derby.tools.ij" fork="true" dir="/opt/continuum-1.0.3/apps/continuum">
<sysproperty key="ij.database" value="jdbc:derby:database"/>
<sysproperty key="ij.user" value="sa"/>
<sysproperty key="ij.password" value=""/>
	<classpath>
<pathelement path="."/>
<fileset dir="/opt/derby/lib" includes="*.jar"/>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
</target>
	<target name="dblook" description="dumps the db schema">
	<java classname="org.apache.derby.tools.dblook" fork="true" dir="/opt/continuum-1.0.3/apps/continuum">
<arg line="-d jdbc:derby:database"/>
	<classpath>
<pathelement path="."/>
<fileset dir="/opt/derby/lib" includes="*.jar"/>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
</target>
</project>

Labels

 
(None)