Wiki source code of Configure Oracle Manually
Last modified by Eleni Cojocariu on 2026/11/25 14:49
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | To configure XWiki to store its data in an Oracle database, once you have [[installed and configured a servlet container>>doc:documentation.xs.admin.installation.servlet-container.WebHome]] with the [[XWiki WAR>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.WebHome]] deployed: | ||
| 2 | |||
| 3 | 1. Install a [[supported Oracle Database version>>dev:Community.SupportStrategy.DatabaseSupportStrategy]]. | ||
| 4 | 1. Download the [[Oracle JDBC driver>>https://www.oracle.com/database/technologies/appdev/jdbc-downloads.html]] matching your Oracle version and the Java version XWiki runs on. | ||
| 5 | 1. Copy the JDBC driver JAR, for example ##ojdbc17.jar##, into the XWiki web application's ##WEB-INF/lib## directory, or into the servlet container's common library directory. | ||
| 6 | 1. Start Oracle and connect to it as a DBA or system user, for example with SQL*Plus.((( | ||
| 7 | {{code language="none"}} | ||
| 8 | sqlplus system/<password>@//localhost:1521/<service name> | ||
| 9 | {{/code}} | ||
| 10 | ))) | ||
| 11 | 1. Create the database user for the main wiki.((( | ||
| 12 | {{code language="sql"}} | ||
| 13 | CREATE USER xwiki IDENTIFIED BY xwiki; | ||
| 14 | {{/code}} | ||
| 15 | ))) | ||
| 16 | 1. Grant the ##xwiki## user the privileges it needs.((( | ||
| 17 | {{code language="sql"}} | ||
| 18 | GRANT CREATE SESSION TO xwiki; | ||
| 19 | GRANT RESOURCE TO xwiki; | ||
| 20 | GRANT DBA TO xwiki; | ||
| 21 | {{/code}} | ||
| 22 | ))) | ||
| 23 | 1. (Optional) List the existing data files, to choose a path for a dedicated tablespace.((( | ||
| 24 | {{code language="sql"}} | ||
| 25 | SELECT * FROM dba_data_files; | ||
| 26 | {{/code}} | ||
| 27 | ))) | ||
| 28 | 1. (Optional) Create a dedicated ##xwiki## tablespace and make it the default for the ##xwiki## user, instead of Oracle's default ##USERS## tablespace.((( | ||
| 29 | {{code language="sql"}} | ||
| 30 | CREATE TABLESPACE xwiki | ||
| 31 | DATAFILE '/opt/oracle/oradata/<SID>/<PDB>/xwiki01.dbf' | ||
| 32 | SIZE 1m | ||
| 33 | AUTOEXTEND ON | ||
| 34 | MAXSIZE 1g; | ||
| 35 | |||
| 36 | ALTER USER xwiki | ||
| 37 | DEFAULT TABLESPACE xwiki | ||
| 38 | TEMPORARY TABLESPACE temp; | ||
| 39 | {{/code}} | ||
| 40 | ))) | ||
| 41 | 1. Give the ##xwiki## user an unlimited quota on the tablespace it uses, since a new user gets none.((( | ||
| 42 | {{code language="sql"}} | ||
| 43 | ALTER USER xwiki QUOTA UNLIMITED ON users; | ||
| 44 | {{/code}} | ||
| 45 | |||
| 46 | Replace ##users## with ##xwiki## if you created a dedicated tablespace in the previous step. | ||
| 47 | ))) | ||
| 48 | 1. Comment out the configuration section of the database currently active in the ##WEB-INF/hibernate.cfg.xml## file of the expanded XWiki WAR. | ||
| 49 | 1. Uncomment the "##Oracle configuration##" section of the same file, in full, including the mapping entries at its end.((( | ||
| 50 | {{code language="xml"}} | ||
| 51 | <property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:XE</property> | ||
| 52 | <property name="hibernate.connection.username">xwiki</property> | ||
| 53 | <property name="hibernate.connection.password">xwiki</property> | ||
| 54 | <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property> | ||
| 55 | <property name="hibernate.connection.SetBigStringTryClob">true</property> | ||
| 56 | <property name="hibernate.jdbc.batch_size">0</property> | ||
| 57 | <property name="hibernate.jdbc.use_streams_for_binary">false</property> | ||
| 58 | <property name="hibernate.dbcp.poolPreparedStatements">true</property> | ||
| 59 | <property name="hibernate.dbcp.maxOpenPreparedStatements">20</property> | ||
| 60 | |||
| 61 | <property name="hibernate.connection.charSet">UTF-8</property> | ||
| 62 | <property name="hibernate.connection.useUnicode">true</property> | ||
| 63 | <property name="hibernate.connection.characterEncoding">utf8</property> | ||
| 64 | |||
| 65 | <mapping resource="xwiki.oracle.hbm.xml"/> | ||
| 66 | <mapping resource="feeds.oracle.hbm.xml"/> | ||
| 67 | <mapping resource="mailsender.oracle.hbm.xml"/> | ||
| 68 | {{/code}} | ||
| 69 | ))) | ||
| 70 | 1. Review the ##hibernate.connection.url## property, and the user name and password, against the database you created. | ||
| 71 | 1. Start XWiki. | ||
| 72 | 1. Open your wiki in a browser. XWiki connects to Oracle, creates its tables on first start, and serves the wiki without a database error. |