Last modified by Vincent Massol on 2020/01/28

Question Is there a (simple) way to get xwiki working with Microsoft SQL Server Database?

The following works with Microsoft SQL Server 2005 Please note! This has not been tested by the XWiki team but currently I have not seen any errors or problems.

Add the JTDS JDBC for MSSQL to the directory WEB-INFlib

1) Download JTDS JDBC driver for MSSQL from 2) Copy the file jtds-1.2.2.jar to the directory WEB-INFlib

Create a hibernate-mapping file for MSSQL (xwiki.mssql.hbm.xml)

The xwiki-core-x.x.x.jar file is located in WEB-INFlib

1) In the root of the xwiki-core-x.x.x.jar file locate the hibernate-mapping file for derby (xwiki.derby.hbm.xml) 2) Create a copy of the file xwiki.derby.hbm.xml name it xwiki.mssql.hbm.xml 3) In the new file xwiki.mssql.htm.xml search and replace the following sql-type="BLOB" --> sql-type="VARBINARY(MAX)" sql-type="CLOB" --> sql-type="VARCHAR(MAX)" 4) Make sure that the new file xwiki.mssql.hbm.xml is added to the root of the xwiki-core-x.x.x.jar

Change the file hibernate.cfg.xml

The hibernate.cfg.xml file is located in WEB-INF

Add the following to the hibernate.cfg.xml, making sure adding the required changes for sqlserver, username and password.

  jdbc:jtds:sqlserver:// sa password net.sourceforge.jtds.jdbc.Driver org.hibernate.dialect.SQLServerDialect 2 2

Create the XWiki database in your SQL Server

Using the SQL Server Administration Interface create a database named XWiki.


Get Connected