• Derby in Embedded mode is a very simple database to configure as you don't need to install nor start it before being able to use it. It comes as a single JAR file named derby*.jar. If your XWiki WAR doesn't have it in WEB-INF/lib you'll need to download it and copy it there. You can download it from the Derby web site or directly from the Maven Central Repository.
  • Once this is done, you need to configure XWiki to use Derby and to tell it where the database files will be created. To do this, edit the WEB-INF/hibernate.cfg.xml file where you have expanded the XWiki WAR file and replace the matching properties with the following ones:
    <property name="connection.url">jdbc:derby:[DATABASE_LOCATION];create=true</property>
    <property name="connection.driver_class">org.apache.derby.jdbc.EmbeddedDriver</property>
    <property name="dialect">org.hibernate.dialect.DerbyDialect</property>

    where [DATABASE_LOCATION] is where you wish to put the Derby database (for example /apps/xwikidb).

    You don't need to specify a username/password property as by default Derby doesn't require them.
    Derby doesn't support VARCHAR larger than 32K and Hibernate doesn't map large fields to correct Derby types (it should use BLOB and CLOB instead of VARCHAR). Thus we need to provide a modified HBM mapping file. Follow the instructions below:

For XWiki 1.1M2 and above

Use the following mapping definition in WEB-INF/hibernate.cfg.xml: <mapping resource="xwiki.derby.hbm.xml"/>. This definition should replace any other similar definition (except for the feeds.hbm.xml definition which is used for something else).

Created by Vincent Massol on 2017/09/06

Get Connected