Wiki source code of DB2 Installation

Last modified by Thomas Mortagne on 2023/10/10

Show last authors
1 {{info}}
2 This has been tested only on DB2 v8.2 and DB2 v9.
3 {{/info}}
4
5 {{warning}}
6 Case-insensitive search does not work with this database; see below for more info. You may want to use the the [[Lucene search application>>extensions:Extension.Search Application]].
7 {{/warning}}
8
9 = Create the xwiki user =
10
11 * This is OS-dependent. Use your favorite tool to create an OS-level user named ##xwiki##
12 * Set xwiki's password to ##xwiki##
13
14 = Create the xwiki database =
15
16 * 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 connecting to XWiki.
17 * Open a DB2 Command Line Processor, either via typing //db2// or on Windows by navigating to Start > All Programs > IBM DB2 > Command Line Tools > Command Line Processor. This will give you a command prompt //db2 =>//.
18 * Create a database with the following code: {{code}}db2 => create database xwiki{{/code}}
19 * Connect to the database to continue the configuration: {{code}}db2 => connect to xwiki{{/code}}
20 * Create a 32K bufferpool and tablespace (this is required because of the length of the rows in a couple of the XWiki tables):(((
21 {{code}}
22 db2 => create bufferpool BFP32K immediate size 1024 pagesize 32k
23 db2 => create regular tablespace TSXWIKI pagesize 32k managed by system using ('/some/directory/cntr_xwiki') bufferpool BFP32K
24 {{/code}}
25 )))
26 * Grant privileges to the xwiki user:(((
27 {{code}}
28 db2 => grant connect, createtab, implicit_schema on database to user xwiki
29 db2 => grant use of tablespace TSXWIKI to user XWIKI
30 {{/code}}
31 )))
32 * Reset connections and quit:(((
33 {{code}}
34 db2 => connect reset
35 db2 => quit
36 {{/code}}
37 )))
38
39 = XWiki configuration =
40
41 * Ensure ##$INSTHOME/sqllib/lib## is in your library path. This is something like ##$LIBPATH##, depending on your OS.
42 * Copy the following files from your DB2 installation directory to the xwiki lib directory:
43 ** ##$INSTHOME/sqllib/java/db2jcc.jar##
44 ** ##$INSTHOME/sqllib/java/db2jcc_license_cu.jar##
45 * Configure 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):(((
46 {{code}}
47 <property name="connection.url">jdbc:db2:xwiki</property>
48 <property name="connection.username">xwiki</property>
49 <property name="connection.password">xwiki</property>
50 <property name="connection.driver_class">com.ibm.db2.jcc.DB2Driver</property>
51 <property name="dialect">org.hibernate.dialect.DB2Dialect</property>
52 <property name="connection.pool_size">2</property>
53 <property name="statement_cache.size">2</property>
54
55 <mapping resource="xwiki.db2.hbm.xml"/>
56 <mapping resource="feeds.hbm.xml"/>
57 {{/code}}
58 )))
59
60 = Make search case-insensitive =
61
62 If you try to do a search via [[Main.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 found is to remove all the calls to UPPER() in [[Main.WebSearch]]. Alternatively, you may want to examine the [[Lucene search application>>extensions:Extension.Search Application]].

Get Connected