New NodeJS Database Driver for Oracle Released
Written by Nikos Vaggalis   
Tuesday, 26 July 2022

Version 5.4 of node-oracledb, the Node.js and TypeScript module for accessing the Oracle Database, has been released and is available from npm.

The node-oracledb add-on for Node.js allows applications to be written in TypeScript, or directly in JavaScript. Version 5.4 connects Node.js 14, or later, to an Oracle Database.

Last month in "New Database Drivers for Oracle and PostgreSQL Released" w looked at another recent driver release for the Oracle database, but for another language - Python. That driver had a major name change from cx_Oracle to python-oracledb to signal the change that the new driver is a thin driver and therefore makes no use of the Oracle Client libraries. As such it was aligned with the rest of the language*-oracledb naming schemes as node-oracledb does.

However, and this is the oxymoron, if considering that the change in naming style marks that the driver is thin, this is not the case for node-oracledb; it still requires the Oracle Client libraries. But given the release of a 'thin' driver for Python, something like that is about to happen for Node.js too. That is, Node.js, not JavaScript, since under the hood some Node.js libraries are necessary.

The highlights of the 5.4 release are: 

  • Support for token based authentication when establishing pool based connections and standalone connections. Token based authentication allows Oracle Cloud Infrastruction users to authenticate to Oracle Database with Oracle Identity Access Manager (IAM) tokens. Token authentication can be performed when node-oracledb uses Oracle Client libraries 19.14 (or later), or 21.5 (or later).
  • The introduction of connection. isHealthy(), a synchronous function which returns a Boolean indicating the health status of a connection. Connections may become unusable in several cases, such as if the network socket is broken, if an Oracle error indicates the connection is unusable or after receiving a planned down notification from the database. If this function returns false, the connection should be closed by the application and a new connection should be established instead. 

Of course, the release comes with the usual bug fixes and performance improvements.

If you install it for the first time, the following stack comes along :

1. Install Oracle Database

2. Create a Database User

3. Install Node.js

4. Install node-oracledb

Using your favorite editor, create a new file package.json in a directory of your choice. It should look something like this :

{
"name": "Demo",
"version": "1.0.0",
"private": true,
"description": "Demo app",
"keywords": [
"myapp"
],
"dependencies": {
"oracledb": "^5.4.0"
},
"author": "You",
"license": "MIT"
}

Install node-oracledb with: npm install

But by far the easiest way however is to use a Pre Built VirtualBox image available from OTN which contains an Oracle Database and the required client libraries. Then add Node.js and the node-oracledb package to this VM and start developing.

Then brush up your Oracle SQL with Analytic SQL for Developers,a free, self-paced, quick and official Oracle course, about the concepts and syntax behind SQL's Analytic functions.

 

More Information

node-oracledb Github

node-oracledb npm

documentation

Pre Built VirtualBox image

Related Articles

New Database Drivers for Oracle and PostgreSQL Released

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


Five Tips for Managing Hybrid Development Teams
08/03/2024

Managing hybrid development teams can be challenging, but  can also be a rewarding endeavor. Here are some tips to follow to ensure success. 



Quantum Company Wins Digital Startup Contest
03/03/2024

Quantum specialists Qilimanjaro is the winner of this year's Four Years From Now competition. The award was made at this year's Mobile World Congress (MWC) in Barcelona.


More News

raspberry pi books

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Tuesday, 26 July 2022 )