Configure Oracle for XWiki in Docker
Steps
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 with the XWiki WAR deployed:
- Install Docker.
- Start the XWiki Oracle container.
docker run --name oracle-xwiki \ -p 1521:1521 \ -v oracle-data:/opt/oracle/oradata \ -d xwiki/oracle-database:latestThe image already holds the xwiki user, its privileges and its tablespace, in a pluggable database named XWIKI. Its first start takes a few minutes.
- Download the Oracle JDBC driver from Maven Central.
- 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.
- Comment out the configuration section of the database currently active in the WEB-INF/hibernate.cfg.xml file of the expanded XWiki WAR.
- Uncomment the "Oracle configuration" section of the same file, in full, including the mapping entries at its end.
- 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.
<property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521/XWIKI</property> <property name="hibernate.connection.username">xwiki</property> <property name="hibernate.connection.password">xwiki</property> - Save the configuration changes.
- Restart XWiki to apply the changes.
- 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.
FAQ
Which Oracle version does the image hold?
Oracle Database 19.3.0 Standard Edition 2, with the container database XWIKICDB, the pluggable database XWIKI and the xwiki user already created. It is the image XWiki's own functional tests run against, and how it is built is documented in the repository.
Is the image suitable for production?
No. It is a test image, pinned to one Oracle release and rebuilt only for XWiki's own testing. For production, install Oracle yourself, as described in Configure Oracle Manually.
Why can XWiki not reach the container, reporting a network adapter error or ORA-609?
Docker networking is the usual cause, not Oracle. The shortest fix is to start the Oracle container on Docker's own host network, by adding --network host to the command in step 2. Otherwise put both containers on one user-defined network, connecting the XWiki container to it the same way, and use the Oracle container name in the connection property instead of localhost:
docker network create oracle-net
docker network connect oracle-net oracle-xwikiHow do I run SQL commands inside the container?
Open a shell in it with docker exec -it <container id> bash -l, then run sqlplus system/xwiki@//localhost:1521/XWIKI for the XWiki pluggable database, or sqlplus sys/xwiki@//localhost:1521/XWIKICDB as sysdba for the container database.
How do I remove the container and its data?
Run docker stop oracle-xwiki, docker rm oracle-xwiki and docker volume rm oracle-data.
Related
- Configure Oracle Manually.
- Configure Oracle in a Virtual Machine.
- Database Configuration for XWiki in Docker.
- Oracle Listener Connection Errors, for the memory and process limits a container hits first.