Legacy Oracle Database Driver (node-oracle)
The `oracle` package provides an obsolete Node.js driver for Oracle databases. It reached version 0.4.1 before being officially abandoned by its maintainer. This driver is not actively developed, receives no updates, and is not recommended for new projects or existing applications. The project explicitly states it is no longer maintained and directs users to the official `node-oracledb` package, developed and supported by Oracle, as its direct and modern replacement. There is no defined release cadence, and its key differentiator is its historical role as an early community-contributed Oracle driver before Oracle released its own official solution.
Common errors
-
Error: Cannot find module 'oracle'
cause The package is not installed or the path is incorrect.fixEnsure `npm install oracle@0.3.9` was run (though highly discouraged). Prefer `npm install oracledb` instead. -
Error: NJS-045: cannot load the Oracle Dynamic Library
cause Missing or incorrectly configured Oracle Client libraries (e.g., Instant Client). This package often had complex native dependencies.fixFor the `oracle` package, ensuring proper ORACLE_HOME or LD_LIBRARY_PATH was difficult. For `node-oracledb`, refer to its installation guide for setting up Oracle Instant Client: https://github.com/oracle/node-oracledb/blob/main/INSTALL.md -
TypeError: oracle.connect is not a function
cause The `oracle` module was not successfully required, or an older/corrupted version was installed.fixVerify installation. However, this error is a strong indicator to migrate away from this abandoned package to `node-oracledb`.
Warnings
- breaking This package is explicitly unmaintained and abandoned. It will not receive security patches, bug fixes, or compatibility updates. Using it in production is a significant risk.
- gotcha The `oracle` package is highly unlikely to be compatible with recent versions of Node.js or modern Oracle client libraries without significant effort, if at all.
- deprecated The official recommendation from the maintainer is to install and use `node-oracledb` instead. The `oracle` package serves no current purpose.
Install
-
npm install oracle -
yarn add oracle -
pnpm add oracle
Imports
- oracle
const oracle = require('oracle'); - connect
const oracle = require('oracle'); oracle.connect( /* ... */ ); - Pool
const oracle = require('oracle'); const pool = new oracle.Pool( /* ... */ );
Quickstart
/*
This quickstart is intentionally left blank.
The `oracle` package is abandoned and not maintained.
It is strongly advised against using this package in any project.
Please use the officially supported `oracledb` package instead:
npm install oracledb
Refer to the `node-oracledb` documentation for its quickstart:
https://github.com/oracle/node-oracledb
*/
// Placeholder to fulfill quickstart requirements, do NOT run this code.
// It is likely to fail with modern Node.js versions or require specific Oracle client setups.
// const oracle = require('oracle');
// oracle.connect(
// { hostname: 'localhost', port: 1521, database: 'ORCL', user: 'hr', password: 'hr' },
// function (err, connection) {
// if (err) {
// console.error("Error connecting to Oracle database:", err);
// return;
// }
// console.log("Successfully connected to Oracle!");
// connection.execute("SELECT 'Hello World' FROM DUAL", [], function (err, results) {
// if (err) {
// console.error("Error executing query:", err);
// }
// console.log("Query result:", results);
// connection.close();
// });
// }
// );