Archiva User DB on Derby Network Server

Archiva is known to work with embedded Derby, so the Derby Network Server is a natural first choice for moving Archiva's user store to an "external" database.

See: http://db.apache.org/derby/papers/DerbyTut/ns_intro.html

  1. Download and unpack db-derby-10.1.3.1-bin.tar.gz (or .zip)
  2. Set the DERBY_INSTALL environment variable to /path/to/db-derby-10.1.3.1-bin
  3. Set the DERBY_SERVER_HOST environment variable to the hostname/IP address that will be used for connections. (Optional, it defaults to localhost)
  4. navigate to /path/to/derby-db-10.1.3.1-bin/frameworks/NetworkServer/bin
  5. execute the 'setNetworkServerCP' script to set the CLASSPATH
  6. execute the 'startNetworkServer' script

The Derby Network Server should now be listening on port 1527.

The default userid is 'user1'. The default password is also 'user1'. (Using 'sa' with no password did not work.)

On the Archiva side,

1. place 'derbyclient.jar' in archiva/core
2. edit /archiva/conf/plexus.xml

          <!--
               Datasources
          -->
          <resource>
            <name>jdbc/users</name>
            <type>javax.sql.DataSource</type>
            <properties>
              <property>
                <name>driverClassName</name>
                <value>org.apache.derby.jdbc.ClientDriver</value>
              </property>
              <property>
                <name>url</name>
                <value>jdbc:derby://localhost:1527/archiva-users;create=true</value>
              </property>
              <property>
                <name>username</name>
                <value>user1</value>
              </property>
              <property>
                <name>password</name>
                <value>user1</value>
              </property>
            </properties>
          </resource>

Then start Archiva.

Derby Database File Locations

With the configuration given above, the 'archiva-users' directory containing the database files will be created in $DERBY_INSTALL/frameworks/NetworkServer/bin.

As described in the Derby docs, you can set derby.system.home and provide a path relative to that, or give the full path in the jdbc connection url.

Questions

How do you add another user to the external Derby database, and delete the default 'user1' account? (Are there any other default accounts?)