具有oracledb@3.0.0连接的Node.js@10.9.0不接受正常的连接字符串

时间:2018-10-18 13:08:36

标签: node.js oracledb oracledb-npm

  

案例1:

connectString = (DESCRIPTION =(地址=(PROTOCOL = TCP)(HOST = dev.xyz.net)(PORT = 1521))(CONNECT_DATA =(SERVICE_NAME = pdb_qa12c)))

  

案例2:

connectString = dev.xyz.net:1521/pdb_qa12c

是否出于某种原因,下面的代码仅适用于情况1 而不适用​​于情况2 ,下面是一段代码,

var oracledb = require('oracledb');

oracledb.getConnection(
  {
    user          : "user",
    password      : "pass",
    connectString : "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dev.xyz.net)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=pdb_qa12c)))"
  },
  function(err, connection) {
    if (err) {
      console.error("Receieved Error: ", err.message);
      return;
    }
    console.log('Connection was successful!');

    connection.close(
      function(err) {
        if (err) {
          console.error("Got Error: ", err.message);
          return;
        }
      });
  });

我遇到了案例2 中的错误,

ORA-12154: TNS:could not resolve the connect identifier specified

0 个答案:

没有答案