Database Schema Names

Last modified by Eleni Cojocariu on 2026/10/28 11:06

Reference

Each wiki of an instance is stored in its own database schema. Two properties in xwiki/WEB-INF/xwiki.cfg change how those schemas are named, for an instance that has to fit names someone else decides. Both are read at startup, so a change takes effect on the next restart.

PropertyWhat it namesApplies toShipped as
xwiki.dbThe schema of the main wikiThe main wiki only. Every other wiki keeps its own wiki idCommented out, as xwiki.db=xwiki
xwiki.db.prefixA prefix put in front of the schema nameEvery wiki, the main wiki includedCommented out, empty

The name a wiki gets when xwiki.db is unset

A sub-wiki's schema is its wiki id. The main wiki's is its wiki id too, xwiki on a standard instance, except on the databases that reserve a schema of their own for it:

DatabaseSchema of the main wiki
HSQLDBPUBLIC
H2PUBLIC
Apache DerbyAPP
PostgreSQL, in schema mode, which is the defaultpublic
MySQL, MariaDB, OracleThe wiki id

The name you configure is not always the name that is used

Whatever the two properties produce is adjusted before it reaches the database, and the adjustment applies to the prefix as well:

  • A hyphen becomes an underscore. Many databases do not accept - in a schema name, so a wiki whose id is my-wiki is stored in my_wiki.
  • Oracle, H2 and HSQLDB upper-case the result, so the same wiki is MY_WIKI there.

So the schema to look for in a database client is not necessarily the string written in xwiki.cfg or the wiki id shown in the administration.

#-# [Since 1.6M1]
#-# Force the database name for the main wiki.
# xwiki.db=xwiki

#-# [Since 1.6M1]
#-# Add a prefix to all databases names of each wiki.
# xwiki.db.prefix=

FAQ

Does setting these properties rename a schema that already exists?

No. They tell XWiki which schema to address; nothing is renamed or copied. Pointing a running instance at a different name makes it look for a schema that is not there, so an existing instance needs the schema renamed in the database first, and a backup before that.

Do sub-wikis have to be schemas rather than databases?

That is a separate setting, xwiki.virtual_mode, which decides whether a sub-wiki is a schema of one database or a database of its own. It changes what "schema name" means above, but not how the two properties here behave.

Related

Get Connected