Подключение к базе данных Oracle через nodeJS - PullRequest
0 голосов
/ 28 октября 2019

Я пытаюсь установить соединение с Oracle, используя NodeJS, но при попытке установить соединение я получаю сообщение об ошибке ниже.

Error:  Error: 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
Node-oracledb installation instructions: https://oracle.github.io/node-oracledb/INSTALL.html
You must have 64-bit Oracle client libraries in your PATH environment variable.
If you do not have Oracle Database on this computer, then install the Instant Client Basic or Basic Light package from
http://www.oracle.com/technetwork/topics/winx64soft-089540.html
A Microsoft Visual Studio Redistributable suitable for your Oracle client library version must be available.

    at OracleDb.getConnection (C:\NodeCon\node_modules\oracledb\lib\oracledb.js:270:10)
    at C:\NodeCon\node_modules\oracledb\lib\util.js:180:16
    at new Promise (<anonymous>)
    at OracleDb.getConnection (C:\NodeCon\node_modules\oracledb\lib\util.js:168:14)
    at C:\NodeCon\server.js:41:32
    at Object.<anonymous> (C:\NodeCon\server.js:58:3)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14) {
  errorNum: 0,
  offset: 0

Я скачал и установил 64-битную клиентскую библиотеку Oracle, но все еще появляется сообщение об ошибке ниже.

Использование кода Visual Studio v.1.36 в качестве моего редактора.

Код NodeJS, который я использую, выглядит следующим образом:

let connection;
var oracledb = require('oracledb');

(async function(){

    try{

        connection = await oracledb.getConnection({

            user: 'Username',
            password: 'Password',
            connectString: 'hostname:portname/servicename'
        });



        console.log("Successfully connected");
    } catch(err){

        console.log("NOT connected");
    }finally{

        if(connection){
            try{
                await connection.close();
            }catch(err){
                console.log("Errror");
            }
        }
    }
})()

Любая помощь будет высоко оценена. Спасибо.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...