Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-6030

xwiki 2.7 with Oracle does not work with database username other than xwiki

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Fix
    • Minor
    • None
    • 2.7, 3.0 M2
    • Storage
    • Oracle 11.2.0.2 x86_64 version for Linux. Sun JDK 1.6.0_23 on a relatively up-to-date Gentoo linux. Jetty as installed from 2.7 jar installer.
    • Unknown
    • N/A
    • N/A

    Description

      Upon initial configuration of an Oracle JDBC provider for Hibernate, it looks like the core XWiki jar or related Hibernate storage component might be hardcoded to use 'xwiki' for the schema name unless the xwiki.db property is set.

      The symptoms match XWIKI-1719
      http://jira.xwiki.org/jira/browse/XWIKI-1719

      At first,I could not get the hibernate.cfg.xml to work with a schema name/password other than the default (xwiki). The config file is read, but the username and password properties are not honored for DDL statements (like those run on first XWiki startup when the XWiki database schema is empty).

      If I used xwiki for the Oracle schema username, Hibernate persistence works as expected. If I used another schema name, i.e. wiki27, stdout and the client web browser show Java Exceptions like:

      ORA-00942: table or view does not exist
      and
      java.sql.SQLSyntaxErrorException: ORA-01031: insufficient privileges

      Turning on SQL logging and examination of xwiki.log revealed the root cause:

      2011-02-21 10:19:33,419 http://localhost:8080/xwiki/bin/import/XWiki/XWikiPreferences ERROR store.XWikiHibernateBaseStore - Failed updating schema while executing query [create table xwiki.activitystream_events (ase_eventid varchar2(255 char) not null, ase_requestid varchar2(2000 char), ase_stream varchar2(255 char), ase_date timestamp, ase_priority number(10,0), ase_type varchar2(255 char), ase_application varchar2(255 char), ase_user varchar2(255 char), ase_wiki varchar2(255 char), ase_space varchar2(255 char), ase_page varchar2(255 char), ase_url varchar2(2000 char), ase_title varchar2(2000 char), ase_body varchar2(2000 char), ase_version varchar2(30 char), ase_param1 varchar2(2000 char), ase_param2 varchar2(2000 char), ase_param3 varchar2(2000 char), ase_param4 varchar2(2000 char), ase_param5 varchar2(2000 char), primary key (ase_eventid))]
      java.sql.SQLSyntaxErrorException: ORA-01918: user 'XWIKI' does not exist

      It turns out some XWiki persistence component, possibly related to the virtual wiki support, specifies fully-qualified schema.table names in DDL statements and is hardcoded to xwiki for the schema name. The username property in the Oracle section of hibernate.cfg is honored for logging in to the database, but not for subsequent DDL. So the XWiki database session is trying to create a table in another user's schema.

      Workaround

      The workaround is to force the schema name in the xwiki.cfg file. E.g. to use a oracle schema name of xwiki27:

          1. [Since 1.6M1] #-# Force the database name for the main wiki in virtual mode and for the wiki itself in non virtual mode. # xwiki.db=xwiki xwiki.db=xwiki27

      Attachments

        Activity

          People

            softec Denis Gervalle
            qconner Quentin Conner
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: