Wiki source code of Configure Oracle for XWiki in Docker
Last modified by Eleni Cojocariu on 2026/11/25 14:48
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | To configure XWiki to store its data in an Oracle database running in a Docker container, 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 [[Docker>>https://docs.docker.com/engine/]]. | ||
| 4 | 1. Start the XWiki Oracle container.((( | ||
| 5 | {{code language="bash"}} | ||
| 6 | docker run --name oracle-xwiki \ | ||
| 7 | -p 1521:1521 \ | ||
| 8 | -v oracle-data:/opt/oracle/oradata \ | ||
| 9 | -d xwiki/oracle-database:latest | ||
| 10 | {{/code}} | ||
| 11 | |||
| 12 | The image already holds the ##xwiki## user, its privileges and its tablespace, in a pluggable database named ##XWIKI##. Its first start takes a few minutes. | ||
| 13 | ))) | ||
| 14 | 1. Download the Oracle JDBC driver from [[Maven Central>>https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc17/]]. | ||
| 15 | 1. Copy the JDBC driver JAR into the XWiki web application's ##WEB-INF/lib## directory, the servlet container's common library directory, or ##TOMCAT_HOME/lib##. | ||
| 16 | 1. Comment out the configuration section of the database currently active in the ##WEB-INF/hibernate.cfg.xml## file of the expanded XWiki WAR. | ||
| 17 | 1. Uncomment the "##Oracle configuration##" section of the same file, in full, including the mapping entries at its end. | ||
| 18 | 1. Set the connection properties to the container's ##XWIKI## pluggable database, using ##localhost## if XWiki runs directly on the host, or the Oracle container name if XWiki also runs in Docker on a shared network.((( | ||
| 19 | {{code language="xml"}} | ||
| 20 | <property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521/XWIKI</property> | ||
| 21 | <property name="hibernate.connection.username">xwiki</property> | ||
| 22 | <property name="hibernate.connection.password">xwiki</property> | ||
| 23 | {{/code}} | ||
| 24 | ))) | ||
| 25 | 1. Save the configuration changes. | ||
| 26 | 1. Restart XWiki to apply the changes. | ||
| 27 | 1. Open your wiki in a browser. XWiki connects to the Oracle container, creates its tables on first start, and serves the wiki without a database error. |