Creating a Sandbox for Learning Node.js and Oracle Database

By May 3, 2017 Uncategorized

With Oracle Database 12.2 and Node.js 8 now available, this is a great time to create a local sandbox for learning. Thanks to some prebuilt VMs provided by Oracle, you can have such an environment up and running in less than 20 minutes (excluding download times) without spending a dime! 😄

In this post, I’ll walk you through the creation of such a sandbox. Here’s an overview of what we’ll be working through:

Install VirtualBox

The first thing you’ll want to do is install VirtualBox 5.1 or later. What is VirtualBox? From the online documentation:

VirtualBox is a cross-platform virtualization application. What does that mean? For one thing, it installs on your existing Intel or AMD-based computers, whether they are running Windows, Mac, Linux or Solaris operating systems. Secondly, it extends the capabilities of your existing computer so that it can run multiple operating systems (inside multiple virtual machines) at the same time.

VirtualBox is a great solution for this type of sandbox because we don’t have to install any software on our host operating system which would consume resources when not in use. I will not cover the installation process in any detail as it will vary depending on your host OS. Just navigate to the downloads page and download & install the appropriate binaries for your OS.

Import the Database App Development VM

Oracle provides a number of pre-built development VMs that are great for learning Oracle technology as you don’t have to muddle through complicated installs to get going. Head to the Pre-Built Developer VMs page and scroll down until you see the Database App Development VM.

Check out all the goodies in that VM! Note that Oracle Database includes a number of enhancements for working with JSON. See the Database JSON Developer’s Guide for details and give them a go once the VM is up and running.

Click the link that says Downloads and Instructions. On the next page, accept the license agreement and then click the link to download the VM.

If you’ve not already authenticated with your Oracle account, you’ll be redirected to a page to do so before the download begins. If you don’t have an account just click the Create Account button on that page to create your free account.

Once the download completes you’ll be ready to import the VM into VirtualBox. Open VirtualBox and click File > Import Appliance. Use the appliance import wizard to select the DeveloperDaysVM2017-06-13_01 file you downloaded and click Import.

The import process will begin once you accept the license agreement. After a few minutes, you should see the following screen.

If you click the Start button a new window will open up with the VM running a terminal inside (you can resize the VM window as needed).

Here are a few tips to get you started inside the VM:

  • The password for everything is: oracle
  • Double-click the large START icon on the desktop to open a browser with labs on a variety of Oracle technology.
  • To access APEX, navigate the browser to http://localhost:8080/apex. Log in using OBE for the workspace and username fields and oracle for the password.
  • To be able to copy/paste things between the host and guest OS, go to the VirtualBox menu bar and select Devices > Shared Clipboard > Bidirectional. Trust me, this will come in handy!

With the VM up and running we’re ready to install Node.js and Git.

Install Node.js and Git

In this section, we’ll install Node.js and Git. Git will be used to install the Node.js driver for Oracle Database in the next step.

Open a terminal and switch to the root user:

Run the following commands as the root user:

That’s all there is to it, Node.js and Git are ready to go. On to the driver!

Install the Node.js Driver and Run a Test

Example scripts for the driver can be found at: The easiest way to start running the examples is to use Git to clone the driver repo from GitHub. From there we can copy the examples into our own directory, change the password in dbconfig.js, install the driver, and start testing!

Now run the following commands:

Running other examples only requires node followed by the name of the example you’d like to run:

Enjoy your new sandbox!


  • Omar Sawalhah says:

    Hi Dan,
    I followed the steps, and I got this warning
    npm WARN enoent ENOENT: no such file or directory, open ‘/u01/userhome/oracle/projects/oracledb-examples/package.json’
    no file is there, but
    >node select1.js
    worked fine, I tried to execute
    >node select2.js
    throw err;

    Error: Cannot find module ‘async’
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object. (/u01/userhome/oracle/projects/oracledb-examples/select2.js:31:13)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)

    • danmcghan says:

      Interesting… Seems there’s a dependency, but there’s no package.json file in the examples directory. Open a terminal, change directories to where the examples are, then run the following to create the package.json: npm init -y. Then run this to install async: npm install async --save. The --save will add async to the list of dependencies in the package.json file.

  • Omar Sawalhah says:

    Thanks Dan,
    Worked fine.

  • Christopher Jones says:

    An alternative way to install Node.js on Oracle Linux 7 is to use the RPMs from

    After creating a file /etc/yum.repos.d/ol7_developer_nodejs8.repo with the following contents, you can simply run ‘yum install nodejs’

    name=Oracle Linux $releasever Node.js 8 Packages for Development and test ($basearch)

  • Pia Cainglet says:

    Thank you! This is only the second tutorial I came across that I was able to get to work first time around. Worked like a charm. Running on a Win 7 machine (personally built).

Leave a Reply