DPI-1047:无法通过nodejs代码找到64位Oracle Client库

时间:2020-04-22 23:40:09

标签: node.js oracle express

我正在尝试建立一个简单的数据库连接以从Express / Node应用程序运行sql查询,当我命中端点时,我看到以下错误:

message:"DPI-1047: Cannot locate a 64-bit Oracle Client library: "The specified module could not be found". See https://oracle.github.io/odpi/doc/installation.html#windows for help\nNode-oracledb installation instructions: https://oracle.github.io/node-oracledb/INSTALL.html\nYou must have 64-bit Oracle client libraries in your PATH environment variable.\nIf you do not have Oracle Database on this computer, then install the Instant Client Basic or Basic Light package from\nhttp://www.oracle.com/technetwork/topics/winx64soft-089540.html\nA Microsoft Visual Studio Redistributable suitable for your Oracle client library version must be available.

我从代码中所做的就是

result = connection.execute(sql); 

我创建了一个小的快递应用程序,我试图在http://localhost:3000/url上调用一个url,该URL从表查询中进行简单的select *。我不确定为什么需要任何类型的Oracle安装。这是我的完整代码:

var express = require("express");
var expressapp = express();
var oracledb = require('oracledb');
var dbConfig = require('./dbconfig.js');

expressapp.listen(3000, () => {
    console.log("Server running on port 3000");
});

expressapp.get("/url", (req, res, next) => {

let connection, result, sql;

sql = `SELECT * FROM user_table WHERE FNAME = 'TEST'`;
binds = {};

// For a complete list of options see the documentation.
options = {
  outFormat: oracledb.OUT_FORMAT_OBJECT   // query result format
  // extendedMetaData: true,   // get extra metadata
  // fetchArraySize: 100       // internal buffer allocation size for tuning
};

connection = oracledb.getConnection({
    user          : "xxxxx",
    password      : "xxxxx",
    connectString : "xxxxxxxxxxxxxxx"
  });

result = connection.execute(sql);
console.log("Response: ");
console.log(result);

res.json(result);
}); 

1 个答案:

答案 0 :(得分:2)

用于连接到数据库的oracle'oracledb'驱动程序(node-oracledbrequires the Oracle client

您可以在https://www.oracle.com/database/technologies/instant-client.html上找到Oracle客户端

相关问题