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


Data Wrangler Gets Copilot Integration
11/11/2024

Microsoft has announced that Copilot is being integrated into Data Wrangler. The move will give data scientists the ability to use natural language to clean and transform data, and to get help with fi [ ... ]



Go At Highest Rank Ever in TIOBE Index
20/11/2024

Go is currently in 7th place in the TIOBE Index for November 2024. Not only is this is the highest position it has ever had, it's percentage rating is almost equal to its all-time-high. Will Go contin [ ... ]


More News

espbook

 

Comments




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

Last Updated ( Tuesday, 26 July 2022 )