admin管理员组

文章数量:1122851

DPI

我试图建立一个简单的数据库连接,以便从expressnode应用程序中运行sql查询,当我击中我的端点时,我看到以下错误。

message:"DPI-1047: Cannot locate a 64-bit Oracle Client library: "The specified module could not be found". See .html#windows for help\nNode-oracledb installation instructions: .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\n.html\nA Microsoft Visual Studio Redistributable suitable for your Oracle client library version must be available.

我在我的代码中所做的就是

result = connection.execute(sql); 

我创建了一个小的快递应用程序,我试图调用一个网址在 http:/localhost:3000url 做一个简单的select * from table查询。我不知道为什么我需要安装任何类型的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);
}); 
回答如下:

oracle 'oracledb' 驱动程序 (节点-oracledb) 需要Oracle客户端 来连接数据库。

你可以在 https:/www.oracledatabasetechnologiesinstant-client.html

本文标签: DPI