DB2 Installation

This has been tested only on DB2 8.2 Case-insensitive search does not work with this database; see below for more info. You may want to use the the Lucene search page

Create the xwiki user

  • This is OS-dependent. Use your favorite tool to create an OS-level user named 'xwiki'.
  • Set xwiki's password to 'xwiki'.

Create the xwiki database

  • First make sure your database instance width matches the JVM. If you have a 32-bit JVM you need a 32-bit instance. 64-bit JVM requires a 64-bit instance. If they don't match, you will get an UnsatisfiedLinkError when first talking to XWiki.
  • Open a DB2 Command Line Processor, either via typing 'db2' or on Windows choosing Start > All Programs > IBM DB2 > Command Line Tools > Command Line Processor. This will give you a command prompt 'db2 =>'.
  • Create a database with the following:
db2 => create database xwiki
  • Connect to the database to continue configuration
db2 => connect to xwiki
  • Create a 32K bufferpool and tablespace; this is required because of the length of the rows in a couple of the XWiki tables
db2 => create bufferpool BFP32K immediate size 1024 pagesize 32k
db2 => create regular tablespace TSXWIKI pagesize 32k managed by system using ('/some/directory/cntr_xwiki') bufferpool BFP32K
  • Grant privileges to the xwiki user
db2 => grant connect, createtab, implicit_schema on database to user xwiki
db2 => grant use of tablespace TSXWIKI to user XWIKI
  • Reset connections and quit
db2 => connect reset
db2 => quit

XWiki configuration

  • Ensure $INSTHOME/sqllib/lib is in your library path. This is something like $LIBPATH, depending on your OS.
  • Copy the following files from your DB2 installation directory to the xwiki lib directory:
    • $INSTHOME/sqllib/java/db2jcc.jar
    • $INSTHOME/sqllib/java/db2jcc_license_cu.jar
  • Tell XWiki to use DB2. To do this, edit the WEB-INF/hibernate.cfg.xml file where you have expanded the XWiki WAR file. Replace the matching properties with the following ones (or uncomment them if they are present):
<property name="connection.url">jdbc:db2:xwiki</property>
<property name="connection.username">xwiki</property>
<property name="connection.password">xwiki</property>
<property name="connection.driver_class">com.ibm.db2.jcc.DB2Driver</property>
<property name="dialect">org.hibernate.dialect.DB2Dialect</property>
<property name="connection.pool_size">2</property>
<property name="statement_cache.size">2</property>

<mapping resource="xwiki.db2.hbm.xml"/>
<mapping resource="feeds.hbm.xml"/>
  • The file xwiki.db2.hbm.xml is not currently shipped with XWiki, so it must be added to the installation. The easiest way to do this is to create the file as WEB-INF/classes/xwiki.db2.hbm.xml (creating the classes directory if needed) and restarting XWiki.

Make search case-insensitive

If you try to do a search, via WebSearch, you will get a big DB2 SQLException with SQLCODE: -440. This is caused because the UPPER() function only works for columns with 250 bytes of data or so in it. Since XWiki calls UPPER() for an entire CLOB column, this just doesn't work. The only solution I have found is to remove all the calls to upper() in WebSearch.

Alternatively, you may want to examine the Lucene search page.

Tags:
   

Get Connected