Wiki source code of Derby Installation

Last modified by Vincent Massol on 2020/01/28

Show last authors
1 * 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>>]].
2 * 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:(((
3 {{code}}
4 <property name="connection.url">jdbc:derby:[DATABASE_LOCATION];create=true</property>
5 <property name="connection.driver_class">org.apache.derby.jdbc.EmbeddedDriver</property>
6 <property name="dialect">org.hibernate.dialect.DerbyDialect</property>
7 {{/code}}
9 where //[DATABASE_LOCATION]// is where you wish to put the Derby database (for example ///apps/xwikidb//).
11 {{info}}
12 You don't need to specify a username/password property as by default Derby doesn't require them.
13 {{/info}}
14 )))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:
16 = For XWiki 1.1M2 and above =
18 Use the following mapping definition in //WEB-INF/hibernate.cfg.xml//: {{code}}<mapping resource="xwiki.derby.hbm.xml"/>{{/code}}. This definition should replace any other similar definition (except for the ##feeds.hbm.xml## definition which is used for something else).

Get Connected