The leading edge of scripting languages and Oracle Database brought to you by the Data Access Development team

Introducing node-oracledb - a Node.js driver for Oracle Database

Christopher Jones
Senior Principal Product Manager

When we announced we were working on a Node.js driver for Oracle Database, it was to a large, enthusiastic audience at Oracle OpenWorld. I'm excited to let you know we have just pushed node-oracledb to GitHub.

Node.js is an upcoming, open source, cross-platform runtime environment for writing server-side and networking applications in JavaScript.

What is node-oracledb?

The node-oracledb driver connects to Oracle Database to make Node.js applications fast and functional. The node-oracledb 0.2 driver preview release already supports:

Node-oracledb is an open source project maintained by Oracle under the Apache 2.0 license. Contributions can be made under The Oracle Contributor Agreement

Where can I get node-oracledb?

To install node-oracledb, clone the repo, install the free Oracle Instant Client (or use a local Oracle Database such as the free Oracle Express Edition), and use npm to install from the cloned directory. The full instructions show how to create a local Node.js instance and covers more details. The driver is currently only on GitHub.

The driver uses Oracle client libraries - the same way Oracle Database drivers for other C based scripting languages do. This means it can take advantage of the significant feature set, engineering, and testing invested in those libraries. It also allows Node.js applications to talk to multiple different versions of the database with Oracle's standard client-to-server version compatibility.

The node-oracledb driver will build on Oracle Linux, OS X and Solaris. Our current testing has focused on Oracle Linux 6. Windows support shouldn't be difficult to add - sorry it's not there yet.

How do I use node-oracledb?

A simple query example is:

var oracledb = require('oracledb');
user : "hr",
password : "welcome",
connectString : "localhost/XE"
function(err, connection)
if (err) { console.error(err); return; }
"SELECT department_id, department_name "
+ "FROM departments "
+ "WHERE department_id < 70 "
+ "ORDER BY department_id",
function(err, result)
if (err) { console.error(err); return; }

The output, with Oracle's HR schema, is:

$ node select.js
[ [ 10, 'Administration' ],
[ 20, 'Marketing' ],
[ 30, 'Purchasing' ],
[ 40, 'Human Resources' ],
[ 50, 'Shipping' ],
[ 60, 'IT' ] ]

The examples directory and API documentation contain more examples.

What is the future for node-oracledb?

We are actively working on adding features to node-oracledb including Windows platform support, LOB support, batch fetching / streaming of large query result sets, and DRCP support. We are also working on things like making it available on npmjs.com for standard npm installation, and making our test suite publishable.

We look forward to your constructive feedback so we can incorporate any fixes and "must-haves" into a 1.0 release soon.

I'm looking forward to sharing more with you as the driver progresses. My colleague Dan McGhan will also be evangelizing JavaScript and Oracle at jsao.io.

node-oracledb Links

Join the discussion

Comments ( 9 )
  • anis Tuesday, January 27, 2015

    Excellent, the future looks bright indeed for Oracle database if it keeps up with latest developments in HTML5 world and modern environments. Node.js will become more and more significant in both enterprise and startup worlds so the decision to provide official driver support to it means that many developers/dba's can start utilizing their hard learned knowledge of Oracle systems throughout bleeding-edge applications for their businesses.

  • David Wednesday, January 28, 2015

    ... and PL/SQL execution ... Now that's exciting !

    I never really got into those nosql "databases" that are often advertised in JS stacks. Even if I reckon they are quite relevant for big data or graph like databases, they do lack some key features of traditional RDBMS.

    It was about time you embark on that js-stacks ship.
    If the performance is there, this is very much welcome.
    Congrats and keep up the good work.

  • Chris Jones Wednesday, January 28, 2015

    Thanks for the comments

    Oracle NoSQL Database is great for many things, specially time series analysis. (And it will have its own Node.js driver) http://www.oracle.com/us/products/database/nosql/overview/index.html

  • riaz Monday, February 16, 2015

    How to connect oracle with node.js in windows 7 ? can you give video tutorial or screen short.?

  • Chris Jones Monday, February 16, 2015

    I just released node-oracledb 0.3.1 to github. Windows install instructions are at: https://github.com/oracle/node-oracledb/blob/master/INSTALL.md#instwin

  • jose Thursday, November 9, 2017
    easy to read but when you try to do the same you end up with several errors without solution.
  • Christopher Jones Monday, December 18, 2017
    @jose, details matter. Tell us the problems and we can help. Have you tried node-oracledb v2's pre-built binaries?
  • divi Tuesday, September 8, 2020
    Can i know if it has ability to use kerberos auth to connect to oracle
  • Christopher Jones Tuesday, September 8, 2020
    Authentication and network encryption are all handled by, and configured in, the layers beneath node-oracledb, so if they support it, then yes.
    Note that kerberos on mac is not tested.
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.