Does XWiki support database names other than xwiki?

In hibernate.cfg.xml, the PostgreSQL configuration has this comment:

if you want the main wiki database to be different than “xwiki” (or “public” in schema mode)
you will also have to set the property xwiki.db in xwiki.cfg file

So, I’ve got hibernate.connection.url ending with :5432/production-xwiki and I’ve set xwiki.db thus:

xwiki.db=production-xwiki

However, attempting to access XWiki results in several exceptions, like:

com.xpn.xwiki.XWikiException: Error number 3301 in 3: Exception while switching to database xwiki

all of which mention “database xwiki”.

Can XWiki be configured to use a database name other than xwiki or is it hard-wired? I’ve reported a similar issue with the Docker image but I’m now getting this on an installation of the Debian packages.

It should work normally: https://www.xwiki.org/xwiki/bin/view/Documentation/AdminGuide/Configuration/#HConfigurethenamesofdatabaseschemas

You removed the #, right ?

I use this setup every day with MySQL so it definitely works fine.

Could you paste the complete error ? Changing the database name does not change the id of the main wiki but creates a mapping between xwiki and the actual database so seeing reference to xwiki is expected.

But one thing I see in the mapping code is that “-” is automatically replaced with “_” because it’s not supported by many databases so maybe that’s your issue here. I guess it should be modified to clean only subwikis instead and trust configured main wiki (would be great if you could create an issue about that in https://jira.xwiki.org/browse/XWIKI if you feel that you need the “-”).

I’ve changed the database name to production_xwiki and edited the hibernate and xwiki.cfg files accordingly but it hasn’t helped.

Here is the complete error: https://pastebin.com/TqHfgrr9

Thank you for your help with this.

Note The full stack trace of the root cause is available in the server logs.

That would help a lot. On Debian it should be /var/log/tomcat9/catalina.out (or /var/log/tomcat8/catalina.out depending on your Tomcat version).

@tmortagne The only stack trace I can find is in localhost.2020-09-02.log and I’ve put that here: https://pastebin.com/AnYp9yp8

For completeness, here is the catalina log file: https://pastebin.com/whBN4SAb

Thanks :slight_smile:

Anything else before that ? This one is a consequence of failing to access the right database.

Sorry, no. I stopped tomcat, wiped the logs and restarted the service. Those log files are literally all there is.