Creating a Local Sandbox for Node.js and Oracle Database

By October 15, 2015 Uncategorized

Want to start working with Node.js and Oracle Database in a local sandbox? It’s easier than you might think. 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, of course! 🙂

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:

Part 1: Install VirtualBox

The first thing you’ll want to do is install VirtualBox 5 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 free and it’s 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.


Part 2: 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 and scroll down until you see the Database App Development VM.


Checkout all the goodies in that VM! Also note that Oracle Database includes some really cool JSON enhancements that you’ll be able to start playing with once the VM is imported.

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 OTN_Developer_Day_VM.ova file you downloaded and click Continue.


On the next step of the wizard, you can just leave all the defaults and click the Import button. The import process will begin once you accept the license agreement. After a few minutes you’ll 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). You’ll see a message in the terminal that will help get you started with a number of different labs. It’s important to note that the password to everything is: oracle


If you would like to be able to copy/paste things between the host and guest OS, go to the 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 (which we’ll do via NVM).

Part 3: Install NVM

One of my favorite tools for working with Node.js is the Node Version Manager (NVM). NVM allows you to install multiple versions of Node.js and easily switch between them when needed. This is a great choice for any environment, but even more so for a local sandbox like this.

At the time of this writing the latest version of NVM was 0.29. You might want to check the website for the latest version but to install that version we just need to run this in the terminal in the VM:

That should download and run the install script.


Once NVM is installed, just close and reopen the terminal so that NVM is ready to use. The next thing we need to do is install a version of Node.js. As of the time of this writing the latest version of Node.js that’s supported by the Oracle Database driver is 0.12.x. We can install the latest release with that minor version by entering the following in the terminal (don’t forget to restart the terminal first):

That will install the requested version of Node.js and set it as the current version. You can start using it immediately by typing node and pressing enter. This will enter the interactive mode where you can make some basic JavaScript calls (typically you’d run a file which we’ll do later). Press ctrl + c twice to exit.


At this point, if you were to reopen the terminal and try using Node.js again it wouldn’t work as the current version is just for a terminal session. You could type nvm use 0.12, but having to do that every time you open the terminal might get old. Fortunately, you can set the default in NVM using the default alias as follows:

See how easy NVM makes it to install and work with Node.js? On to the driver!

Part 4: Install the driver and run a sample script

Example scripts for the driver can be found at: The easiest way to start running the examples in the VM is to install Git and clone the 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 running examples!

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

Enjoy your new sandbox!


Leave a Reply