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

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');

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

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

Comments:

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.

Posted by anis on January 27, 2015 at 12:18 AM PST #

... 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.

Posted by David on January 28, 2015 at 08:28 AM PST #

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

Posted by Chris Jones on January 28, 2015 at 09:25 AM PST #

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

Posted by riaz on February 16, 2015 at 08:58 AM PST #

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

Posted by Chris Jones on February 16, 2015 at 10:07 AM PST #

Post a Comment:
Comments are closed for this entry.
About

Tourists looking out over an Opal mine
I'm a Product Manager in Server Technologies, working on scripting languages and developer-access.
Mail: christopher.jones@oracle.com
Twitter: @ghrd
OTN: Scripting Languages
Book: Free PHP Oracle book

Follow:
Blaine Carter
Dan McGhan

Search


Archives
« March 2017
SunMonTueWedThuFriSat
   
1
2
3
4
5
6
7
8
10
11
12
13
14
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
       
Today