接(一)的步骤往下做就可以
(1)搭建本机的oracle环境
下载instantclient_12_2,将其放在相应的文件夹中
链接: https://pan.baidu.com/s/1vbSHBjmxJXVakhXlnmb42A 提取码: r2ee

在系统环境变量中增加path变量


(2)下载oracledb使用命令npm install oracledb --save

(3)在自己的js中写入连接oracle的代码
const oracledb = require(‘oracledb‘);
const DB_CONFIG = {
user: ‘账号‘,
password: ‘密码‘,
connectString: ‘自己的数据库地址/orcl‘ // 数据库地址:{IP:PORT/数据库名称}
}
oracledb.getConnection(
DB_CONFIG,
function (err, connection) {
if (err) {
console.error(err.message);
return;
}
connection.execute(
"SELECT * from 表名",
function (err, result) {
if (err) {
console.error(err.message);
return;
}
console.log(result)
});
});
(4)运行npm start就可以了

原文:https://www.cnblogs.com/yuNotes/p/13304450.html