Node-oracledb 6.7 brings more flexibility and power to Oracle Database apps

Sharad Chandran
3 min readNov 18, 2024

--

Photo by Luke Chesser on Unsplash

Release announcement: A new release of node-oracledb, the Node.js and TypeScript module for accessing Oracle Database, is available from npm.

It has been some time and the latest node-oracledb release (v6.7) is now finally here, with OpenTelemetry support, settable session parameters and much more!

In addition, this release also brings in significant Centralized Configuration Provider support improvements, enhanced CQN support and better error handling.

Tracing feature for OpenTelemetry support
OpenTelemetry provides a set of APIs, SDKs, and tools that enables users to instrument, generate, collect, and export telemetry data (metrics, logs, and traces) to analyze their application’s performance and behavior. The OpenTelemetry project is open-source and available on GitHub.

Node-oracledb 6.7 introduces tracing parameters and methods that can be used by the OpenTelemetry JavaScript project to generate telemetry data. We will be raising a PR for a separate OpenTelemetry instrumentation module for Oracle Database here. Once the module is merged to the main OpenTelemetry module, it can be downloaded as a separate npm package. This module makes use of the tracing feature enabled in node-oracledb to generate the telemetry data for the database connections.

The OpenTelemetry support (once included) provides the application developer the ability to analyze and monitor the connection metrics and tune them, if necessary.

Settable V$ Session Attributes
The values of program, terminal, machine, osUser, and driverName can now be set in oracledb object in Thin mode. These attributes correspond to specific session properties (column) in Oracle Database’s V$SESSION and V$SESSION_CONNECT_INFO views, enabling more customized session behavior (See node-oracledb documentation for the attribute to column mapping). This functionality is not available in Thick mode.

We’ve seen a number of requests for users to be able to set specific values of V$ views. These requests seem to be coming from Java-centric environments since JDBC already allows the relevant, default system values to be overridden. If you want to use Node.js, and your existing application logic or logging protocol needs it, you can now change the values.

Ensure that the length of the values do not exceed the corresponding column lengths in V$SESSION and V$SESSION_CONNECT_INFO views. Note my general recommendation is to not change the defaults, but instead use the clientId, clientInfo, dbOp, module and action settings (see Oracle Database End-to-End Tracing). All of these alternatives are available in Thin and Thick modes, and are designed for you to set your own application metadata values.

Cache and Wallet Support with Centralized Configuration Providers
The Centralized Configuration Providers support just got better with node-oracledb 6.7 with caching capabilities and wallet storage support.

Node.js applications can now cache the configuration information retrieved from Centralized Configuration Providers for quicker access next time. The oracledb.configProviderCacheTimeout property sets the amount of time for node-oracledb to cache the configuration retrieved from the configuration providers. Once the cache expires, node-oracledb refreshes the cache when configuration information from this configuration provider is requested the next time.

Users can also now connect to Oracle Database via the Centralized Configuration Providers using wallets stored in Azure Key Vault and OCI Vault.

Other Features and Updates
A very useful update in node-oracledb’s Continuous Query Notification (CQN) support is the availability of registration id (regId property) to the message object parameter of the CQN subscription callback function. This provides more flexibility to the application developers, when using the CQN feature.

Last, but not by any means least, we have fixed multiple internal and external issues raised by our GitHub users.

See the latest Release Notes for all the changes.

Installing or Upgrading node-oracledb

You can install or upgrade node-oracledb by updating your package.json requirements:

"dependencies": {
"oracledb": "^6.7"
},

Resources

Finally, contributions to node-oracledb are more than welcome, see CONTRIBUTING.

--

--

Sharad Chandran
Sharad Chandran

Written by Sharad Chandran

Sharad Chandran is a Principal Product Manager at Oracle driving development of client interfaces & APIs for Oracle Database in C/C++, Python, Node.js, Go etc.

No responses yet