Configure Oracle in a Virtual Machine
Steps
To configure XWiki to store its data in an Oracle database running in a virtual machine, once you have installed and configured a servlet container with the XWiki WAR deployed:
- Install VirtualBox on the host machine.
- Create a virtual machine and install a supported Oracle Database version in it.
- Set the virtual machine's network adapter to "Bridged Adapter".
- Start the virtual machine and note the IP address it takes on your network.
- Create the xwiki user, grant its privileges and give it a tablespace quota inside the virtual machine, as described in Configure Oracle Manually.
- Copy the Oracle JDBC driver JAR into the WEB-INF/lib directory of the XWiki web application on the host machine, and activate the "Oracle configuration" section of its WEB-INF/hibernate.cfg.xml file, as described in the same page.
- Set the connection properties to the virtual machine's IP address and to the Oracle service name.
<property name="hibernate.connection.url">jdbc:oracle:thin:@192.168.0.49:1521/XEPDB1</property> <property name="hibernate.connection.username">xwiki</property> <property name="hibernate.connection.password">xwiki</property> - Start XWiki.
- Open your wiki in a browser. XWiki connects to the database in the virtual machine, creates its tables on first start, and serves the wiki without a database error.
FAQ
Why does the network adapter have to be bridged?
With the default "NAT" adapter the virtual machine reaches the host, but the host cannot open a connection to the database. "Bridged Adapter" gives the virtual machine its own address on your network.
Can I run all the setup statements in one call?
Yes. Save them to a file inside the virtual machine and pipe that file to SQL*Plus, with echo @xwiki.sql | sqlplus system/<password>@//localhost:1521/<service name>.
Can I use one of Oracle's prebuilt developer virtual machines?
Oracle's prebuilt Database App Development VM holds an Oracle Database release that XWiki no longer supports, so install a supported version in a virtual machine you create yourself.
Should I use a virtual machine or a container?
A container starts faster and needs no operating system installation, so prefer Configure Oracle for XWiki in Docker. A virtual machine is worth the extra work when you have to reproduce a specific Oracle release or operating system.
Related
- Configure Oracle Manually.
- Configure Oracle for XWiki in Docker.
- Oracle Listener Connection Errors, for the memory a virtual machine has to give Oracle.