LDSTechContributeSelf SupportForumWikiJiraProjects

Oracle VM

The Oracle VM provides a convenient way for developers to get a local Oracle database instance up and running as part of the LDS Java Stack. The Oracle VM is a VirtualBox VM running Debian Linux. We can't redistribute Oracle XE so, when the VM first starts up, it downloads and configures Oracle XE automatically.

Contents

Getting started

  1. Download and install VirtualBox. If you already have VirtualBox installed, the Oracle VM is known to work with VirtualBox 4.0.12 - 4.1.0. It will likely work with older versions of VirtualBox but we haven't verified that is the case. Any feedback on what versions of VirtualBox work would be appreciated.
  2. Download the Oracle VM Appliance Zip.
  3. Unzip the Oracle VM and install the provided appliance.
    1. To install the appliance go to File | Import Appliance... in VirtualBox. This will open the Appliance Import Wizard.
    2. Select the Choose... button and the select the LDS Tech VM.ovf file that was extracted from the Oracle VM Appliance Zip. Then click Next.
    3. We do not recommend changing any of the Appliance Import Settings, but if you feel you must, this is where you would make such changes.
    4. Finally, select Finish. This will start importing the appliance
  4. Once the appliance is imported, select the VM and click on the Virtualboxstart.png Start icon. This will bring up a new window that represents the monitor of the virtual machine. The first time you start this virtual machine, it will download and install Oracle XE. You must be connected to the Internet for this to work. This is a 221MB download so it may take some time, depending on your connection speed. We download Oracle XE on first use to avoid potential licensing issues with Oracle.
  5. Once Oracle XE has been downloaded, it will be installed and configured automatically.
  6. Once Oracle XE has been configured, the virtual machine will shut itself down. You need to let the virtual machine shutdown by itself for the installation process to complete.
  7. After the virtual machine has shut down, you need to change the VM's network settings. To do this select the LDS Tech VM and select the Virtualboxsettings.png Settings icon.
  8. Select the Virtualboxnetwork.png setting, and do one of the following:
    • Option #1: (Recommended) To access the Oracle XE instance from localhost, you can forward the virtual machine's ports to the host system. To do this, leave the Attached to value as NAT and expand the Advanced options, then click Port Forwarding and add the following rules:
      • Rule 1: Host Port = 1521, Guest Port = 1521
      • Rule 2: Host Port = 9999, Guest Port = 8080
    • Option #2: To allow your host system to access the Oracle XE instance from the virtual machine's IP address (192.168.56.101), change the Attached to value from NAT to Host-only adapter.
      • Warning #1: This option may fail on OSX and Linux - You can resolve it by adding a host-only network from Preferences->Network->add
      • Warning #2: This option may also fail when using a VPN. If you often work through a VPN, we recommend using option #1.
  9. Restart the VM and you should be ready to start using Oracle XE.

Connecting to the Oracle XE Management Console

  • If you chose NAT network configuration with Port Forwarding (see Option #1 above), you can connect to the Oracle XE Management Console using the URL http://localhost:9999/apex.
  • If you chose the Host-only network configuration (see Option #2 above), you can connect to the Oracle XE Management Console using the URL http://192.168.56.101: 8080/apex.
  • To administer your Oracle XE instance, the username is SYSTEM and the password is oracle.

Developing with the LDSTech Oracle VM

After Oracle XE is installed in the VM, we create a default user called oracle with the password oracle. You can use this user when developing your applications.

To connect to Oracle XE from Java with JDBC, use the connection URL for your network configuration:

  • (NAT with Port Forwarding) jdbc:oracle:thin:@localhost:1521:xe
  • (Host-only) jdbc:oracle:thin:@192.168.56.101:1521:xe

If you want to log into the Linux OS on the VM, the root user's password is ldstech. There is also a non-root user, ldstech with the password ldstech.

Note that you do not have to log in to run the db migrator scripts against the VM. Also, when stopping the the VM select Machine -> ACPI Shutdown, instead of Close.

Running the VM in Headless Mode

If you don't want to have a window up that has your VM running all the time you can run it in Virtualbox headless mode. To do this use a shell script or some other means appropriate to your environment to launch Virtualbox. The command you want to use is something like VBoxHeadless -p 9090 -s "LDS Tech VM 1.1" where -p specifies the port to run the remote desktop server and -s specifies the string that identifies your VM. Once this is set up you can connect to the running VM through any remote desktop client.

Adjusting the VM settings

By default the VM uses 256MB of memory. That may be too much for your system. We have tested the VM using as little as 64MB of memory. Around 128MB should work fine for most development activities (although XE won't install with so little memory which is why we default to 256MB). To change the amount of memory the VM uses go to Virtualboxsettings.png Settings and select the System setting. Under the Motherboard tab there is a Base Memory setting that you can adjust according to your needs.

VM performance/memory info

We have done some basic testing of the VM to see what the performance is with different amounts of memory. This graph should give you an idea of the performance characteristics based on how much memory is available to the VM.

Vm performance chart.png

What the test did:

  • Created 4 tables
  • Inserted a total of 12,000 rows
  • Iterated over 10,000 un-joined rows
  • Joined and iterated over 1000 rows from the 4 tables
  • Updated 10,000 rows
  • Dropped all the tables
This page was last modified on 7 May 2013, at 14:33. This page has been accessed 12,972 times.