标签: node-oracledb

libclntsh.so.12.1:运行node-oracledb示例时无法打开共享对象文件错误

我的目标是从Ubuntu连接到VMWare客户机(OpenSuse)上的oracle数据库.

现在我只安装了oracledb驱动程序,并尝试运行给定的示例连接程序.

我所遵循的步骤来自github INSTALL页面.到目前为止我所做的是这些:

1)因为我已经安装了node.js,所以我跳过了步骤3.1.

2)我已成功下载并解压缩了步骤3.2中提到的基本sdk.

3)因为我找不到任何命名的包,libaio但我确实找到了libaio1.所以我安装了libaio1.

4)我LD_LIBRARY_PATH在我的电脑上创建了环境变量和它的内容/opt/oracle/instantclient.

5)如步骤3.3中所述 ; 即使在我的情况下它不是强制性的; 我制作了两个环境变量:OCI_LIB_DIR内容/opt/oracle/instantclientOCI_INC_DIR内容/opt/oracle/instantclient/sdk/include.

6)已安装node-oracledb.

我正在尝试运行示例连接程序.我正在使用的代码是https://github.com/ishanatmuz/oracle-test.当我跑步时,node connect.js我收到此错误.

/home/ishan/node.js/oracle-test/node_modules/oracledb/lib/oracledb.js:28
throw err;
          ^
Error: libclntsh.so.12.1: cannot open shared object file: No such file or directory
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require …
Run Code Online (Sandbox Code Playgroud)

oracle node.js node-oracledb

12
推荐指数
2
解决办法
2万
查看次数

使用oracledb进行查询时,Node中出现“ npm ERR!errno 3221225477”错误

这是命令行中的错误本身:

npm ERR! code ELIFECYCLE
npm ERR! errno 3221225477
npm ERR! versioncenter@0.0.1 start: `node ./bin/www`
npm ERR! Exit status 3221225477
npm ERR!
npm ERR! Failed at the versioncenter@0.0.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\USERNAME\AppData\Roaming\npm-cache\_logs\2019-11-13T17_17_52_250Z-debug.log
/c/Program Files/nodejs/npm: line 37:  1341 Segmentation fault      "$NODE_EXE" "$NPM_CLI_JS" "$@"
Run Code Online (Sandbox Code Playgroud)

这是错误日志:

0 info it worked if it ends …
Run Code Online (Sandbox Code Playgroud)

javascript node.js npm express node-oracledb

8
推荐指数
3
解决办法
155
查看次数

空闲 Oracle 连接给出错误“ORA-03114:未连接到 ORACLE”

我们有一个连接到 Oracle 数据库实例的 Node.js Web 应用程序,问题是在一些不活动之后,数据库的连接变成了只读模式。这意味着 SELECT 操作有效但 INSERT 和 UPDATE 事务遇到此错误:

“错误:ORA-03114:未连接到 ORACLE”

此问题在重新启动应用程序后解决。我们使用最新版本的 knex(0.20.1) 和 node-oracledb(4.1.0) 库连接到数据库。

oracle node.js ora-03114 knex.js node-oracledb

7
推荐指数
1
解决办法
3248
查看次数

oracledb npm 包安装失败

我正在尝试安装node-oracledb 包,因为我想连接到我的node.js 应用程序中的Oracle 数据库。但是,安装总是失败。据我通过查看错误消息了解到,原因是 Node v9.20 的预构建二进制文件不可用。但是,我无法安装Python并编译源代码,因为我处于受控环境中并且安装Python有点困难。

有没有简单的方法来解决这个问题?

错误消息是,

node package/oracledbinstall.js
oracledb Beginning installation
oracledb ERR! NJS-054: Binary build/Release/oracledb.node was not installed.
oracledb ERR! Pre-built binary packages are not available for Node.js v9.2.0 (NODE_MODULE_VERSION="59")
oracledb ERR! Failed to install binary package oracledb-v3.0.1-node-abi59-win32-x64.gz
oracledb ERR! self signed certificate in certificate chain
oracledb ERR! For help see https://oracle.github.io/node-oracledb/INSTALL.html#troubleshooting
Run Code Online (Sandbox Code Playgroud)

node.js node-oracledb

5
推荐指数
1
解决办法
2867
查看次数

如何重新格式化 oracledb json 输出?

使用带有 outFormat:oracledb.OBJECT 选项的 oracledb node.js 驱动程序会返回 json,但列名格式为大写(属性名遵循 Oracle 的标准命名规则),例如:{"ID":"1"} 是否可以把它们变成小写,像这样:{"Id":"1"}?

在 Oracle Database 12.2 中引入的 JSON_OBJECT 对我不可用。

oracle node.js node-oracledb

3
推荐指数
1
解决办法
4467
查看次数

使用node-oracledb和nodejs永远不会关闭连接池

我正在使用 Node Js 和 Oracle 制作一个小 API,并使用 node-oracledb 来实现。我受到以下文章的指导:API with OracleDB and Node JS

项目文件包含以下内容:

/services/web-server.js

const http = require('http');
const morgan = require('morgan');
const express = require('express');
const webServerConfig = require('../config/web-server');

let httpServer;

function initialize(){
    return new Promise((resolve, reject) => {
        const app = express();
        httpServer = http.createServer(app);

        app.use(morgan('combined'));

        app.get('/', (req, res) => {
            res.end('Hello World');
        });

        httpServer.listen(webServerConfig.port, err => {
            if(err){
                reject(err);
                return;
            }          
            
            console.log(`Web server listening on localhost:${webServerConfig.port}`);

            resolve();
        });
    });
}

module.exports.initialize = initialize;

function …
Run Code Online (Sandbox Code Playgroud)

api node.js oracle18c node-oracledb

3
推荐指数
1
解决办法
3041
查看次数

Node.js - Oracle Driver - 检索 Clob 字段

我正在尝试使用 Oracle Driver (1.4.0) for NodeJS-4.2.2, Express (4.13.3) 从 Oracle DB 中提取数据。

我能够将输出写入流(文件),但无法将其分配给变量对象。下面是代码片段。无论如何,我将 clob 字段输出分配给 var ?

{
                    if (err) { console.error(err.message); return; }
                    if (result.rows.length === 0) { console.log("No results"); return; }

                    var clobe = "";
                    var lob = result.rows[2][1];
                    if (lob === null) { console.log("BLOB was NULL"); return; }

                   // lob.setEncoding('utf8');
                    lob.on(
                        'end',
                        function()
                        {
                            console.log("lob.on 'end' event");
                            res.end();
                        });
                    lob.on(
                        'close',
                        function()
                        {
                            console.log("lob.on 'close' event");
                            connection.release(function(err) {
                                if (err) console.error(err);
                            });
                        });
                    lob.on(
                        'error',
                        function(err)
                        { …
Run Code Online (Sandbox Code Playgroud)

node.js express node-oracledb

2
推荐指数
1
解决办法
3152
查看次数

npm 错误!oracledb 错误!NJS-067:未找到 darwin arm64 的预构建 node-oracledb 二进制文件

我有这个错误

npm ERR! path /Users/honor/Documents/mycompany/node_modules/oracledb
npm ERR! command failed
npm ERR! command sh -c node package/install.js
npm ERR! oracledb ERR! NJS-067: a pre-built node-oracledb binary was not found for darwin arm64
npm ERR! oracledb ERR! Try compiling node-oracledb source code using https://oracle.github.io/node-oracledb/INSTALL.html#github

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/honor/.npm/_logs/2021-11-19T09_09_49_590Z-debug.log

Run Code Online (Sandbox Code Playgroud)

我的环境是node v14.18.1 npm v6.14.15 "oracledb": "^4.2.0", macbook pro 2020 m1

node.js npm node-oracledb

2
推荐指数
1
解决办法
1万
查看次数

调用node-oracledb的createPool方法

我正在创建一个使用 Node.js 和 Express 的 RESTful API。我的应用程序使用 Oracle 数据库,因此我从 npm 安装了 node-oracledb 模块。我浏览了文档并查看了模块的 github 页面中提供的一些示例;但是,我没有看到任何使用连接池的示例。如果我错了,请纠正我,但对于需要多次调用数据库的应用程序,建议使用连接池而不是使用独立连接。下面是我编写的代码示例:

createPool = function(poolAttrs, fetchPool){
  oracledb.createPool(poolAttrs, function(error, pool){
    if(error){
      console.error(`Could not create pool using specified attributes: `, error.message);
    }
    else{
      console.log(`Pool created successfully using poolAlias: ${poolAttrs.poolAlias}`);
      fetchPool(pool);
    }
  });
};

createConnection = function(poolAlias, connection){
  oracledb.getConnection(poolAlias, function(error, conn){
    if(error){
      console.error(`Could not get connection: `, error.message);
    } else {
      console.log(`New connection obtained: ${conn}`);
      connection(conn);
    }
  });
};

executeQuery = function(queryString, poolAlias){
  console.log(queryString);
  var conn = createConnection(poolAlias, function connection(conn){ …
Run Code Online (Sandbox Code Playgroud)

javascript callback node.js node-oracledb

1
推荐指数
1
解决办法
1万
查看次数