Wiki source code of InstallationDerby
Version 1.14 by Vincent Massol on 2007/10/24
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | 1 Derby Installation | ||
2 | |||
3 | * Derby in Embedded mode is a very simple database to configure as you don't need to install nor to start it before being able to use it. It comes as a single JAR file named <tt>derby*.jar</tt>. If your XWiki WAR doesn't have it in <tt>WEB-INF/lib</tt> you'll need to download it and copy it there. You can download it from the [Derby web site>http://db.apache.org/derby/] or directly from the [Maven Central Repository>http://repo1.maven.org/maven2/org/apache/derby/derby/]. | ||
4 | * Once this is done, you need to tell XWiki to use Derby and to tell it where the database files will be created. To do this, edit the <tt>WEB-INF/hibernate.cfg.xml</tt> file where you have expanded the XWiki WAR file and replace the matching properties with the following ones: | ||
5 | |||
6 | {code} | ||
7 | <property name="connection.url">jdbc:derby:[DATABASE_LOCATION];create=true</property> | ||
8 | <property name="connection.driver_class">org.apache.derby.jdbc.EmbeddedDriver</property> | ||
9 | <property name="dialect">org.hibernate.dialect.DerbyDialect</property> | ||
10 | {code} | ||
11 | |||
12 | where ~~\[DATABASE_LOCATION\]~~ is where you wish to put the Derby database. For example ~~/apps/xwikidb~~. | ||
13 | |||
14 | #info("You don't need to specify a username/password property as by default Derby doesn't require them.") | ||
15 | |||
16 | Now 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>http://opensource.atlassian.com/projects/hibernate/browse/HHH-2651]). Thus we need to provide a modified HBM mapping file. Follow the instructions below. | ||
17 | |||
18 | 1.1 For XWiki 1.1M2 and above | ||
19 | |||
20 | Use the following mapping definition in ~~WEB-INF/hibernate.cfg.xml~~: | ||
21 | |||
22 | {code} | ||
23 | <mapping resource="xwiki.derby.hbm.xml"/> | ||
24 | {code} | ||
25 | |||
26 | This definition should replace any other similar definition (except for the "feeds.hbm.xml" definition which is used for something else). | ||
27 | |||
28 | 1.1 For XWiki 1.1M1 | ||
29 | |||
30 | Place this ~~{attach:xwiki.hbm-1.1.xml}~~ file in your ~~WEB-INF/classes~~ directory, rename it to "xwiki.derby.hbm.xml" and add the following mapping definition in ~~WEB-INF/hibernate.cfg.xml~~: | ||
31 | |||
32 | {code} | ||
33 | <mapping resource="xwiki.derby.hbm.xml"/> | ||
34 | {code} | ||
35 | |||
36 | This definition should replace any other similar definition (except for the "feeds.hbm.xml" definition which is used for something else). | ||
37 | |||
38 | 1.1 For XWiki 1.0 and lower | ||
39 | |||
40 | Place this ~~{attach:xwiki.hbm-1.0.xml}~~ file in your ~~WEB-INF/classes~~ directory, rename it to "xwiki.derby.hbm.xml" and add the following mapping definition in ~~WEB-INF/hibernate.cfg.xml~~: | ||
41 | |||
42 | {code} | ||
43 | <mapping resource="xwiki.derby.hbm.xml"/> | ||
44 | {code} | ||
45 | |||
46 | This definition should replace any other similar definition (except for the "feeds.hbm.xml" definition which is used for something else). |