Wiki source code of MSSQL Installation

Version 11.1 by Thomas Mortagne on 2010/09/03

Show last authors
1 1 Microsoft SQL Server Installation
2
3 #info("This has been tested on MSSQL 2000 and MSSQL 2005 (text types are only deprecated in MSSQL 2005, this tutorial won't work when they'll be dropped)")
4
5 #warning("Case-insensitive search does not work with this database; see below for more info. You may want to use the the [Lucene search>code:Applications.SearchApplication]")
6
7 1.1 Create the xwiki user and database
8
9 * Use the Enterprise Manager to create a database named 'XWiki' and a user named 'xwiki'.
10 * Set xwiki's password to 'xwiki'.
11 * Give database ownership of the database XWiki to the user xwiki.
12
13 1.1 Install the JDBC driver
14
15 * Download the [jtds jdbc driver>http://jtds.sourceforge.net/] and install the jar file into your servers lib directory (for JBoss this could be ~~server\\\default\\\lib\\\~~, for Tomcat this might be ~~common\\\lib\\\~~)\\
16
17 #info("The connection was successfully tested with version 1.2.1 of the driver and version 1.5 of XWiki. Some problems occurred when using drivers > 1.2.1 so it might be better to use the old one. ")
18
19 * Alternatively, you can use the [JDBC driver provided by Microsoft>http://www.microsoft.com/downloads/details.aspx?familyid=07287B11-0502-461A-B138-2AA54BFDC03A&displaylang=en], however this has not been thoroughly tested.
20
21
22 1.1 XWiki configuration
23
24 * Tell XWiki to use MSSQL. To do this, edit the ~~WEB-INF/hibernate.cfg.xml~~ file. Replace the matching properties with the following ones (or uncomment them if they are present):
25
26 {code:xml}
27 <property name="connection.url">jdbc:jtds:sqlserver://<server-url>:1433/XWiki;tds=8.0;lastupdatecount=true</property>
28 <property name="connection.username">xwiki</property>
29 <property name="connection.password">xwiki</property>
30 <property name="connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
31 <property name="dialect">org.hibernate.dialect.SQLServerDialect</property>
32 <property name="connection.provider_class">com.xpn.xwiki.store.DBCPConnectionProvider</property>
33 <property name="connection.pool_size">2</property>
34 <property name="statement_cache.size">2</property>
35 <mapping resource="xwiki.mssql.hbm.xml"/>
36 <mapping resource="feeds.hbm.xml"/>
37 <mapping resource="activitystream.hbm.xml"/>
38
39 {code}
40
41
42
43 1.1 Troubleshooting
44
45 1.1.1 Fix search function
46
47 If you try to do a search, via [Main.WebSearch], you will get an error. This is because the UPPER() function doesn not work on TEXT or NTEXT as used by MSSQL 2000 for blobs. The only solution I have found is to remove all the calls to upper() in [Main.WebSearch]. This is however not very practical, because it makes search case&#45;sensitive.
48
49 Alternatively, you may want to use the [Lucene search>code:Applications.SearchApplication] instead of the default search.
50
51 1.1.1 Hints for upgrading to MS SQL 2005
52
53 In MS SQL 2005 the standard schema in all databases is dbo by default. However, if you upgrade your server with the standard Microsoft software, all tables in your xwiki database will be configured to use a schema whichs name is equivalent to the database name. (If your database name is "xwiki", the schema name will also be "xwiki" and the full qualified tablenames will be "xwiki.xwikidoc", and so on)
54
55 Since the standard schema in is configured to be "dbo", xwiki will not find any tables (since it searches for "dbo.xwikidoc", ...). This will result in an exception when calling the xwiki webapp (in the logfiles you will see an "object not found" - exception for xwikidoc, because xwikidoc is the first table to be mapped via hibernate)\\
56 \\
57 There are 2 possible solutions to this problem:
58
59 * Reconfigure your server to use "xwiki" as standard scheme inside the xwiki-database.
60 * Adopt the hibernate file (xwiki.mssql.hbm.xml). Look for the table definitions, eg. ~~table="xwikidoc"~~ and set it to ~~table="xwiki.xwikidoc"~~, or to whatever your schema/database is called. Do this for all tables you can find in the file.

Get Connected