网站搜索

node.js - oracledb 连接问题:无法读取未定义的属性(读取 '_getConnection')


节点 Oracle 连接问题。它在同一个应用中之前已经连接过,但现在无法工作。我更新了节点版本。

连接字符串没有问题,因为同样的连接在同一服务器上的其他应用程序中可以正常工作。

node -v =v16.9.1
npm -v =v7.21.1

包 json:

"dependencies": {
    "@types/oracledb": "^5.1.0",
    "dotenv": "^8.2.0",
    "group-by": "0.0.1",
    "moment": "^2.29.1",
    "oracledb": "^5.1.0",
    "pg-promise": "^10.8.6",
    "tedious": "^9.2.3",
    "tedious-connection-pool": "^1.0.5"
  },

代码:

export const getOracleConnection = async () => {
   try {
      return await getConnection(POSTargetConfig)
   } catch (error) {
      console.log("Errorrrrrrrrr:  " + error.message)
      await TraceLog("Error", error.message);
      await onRejected();
   }
}

export const POSTargetConfig = {
  user: "name",
  password: 'pass',
  connectString: `(DESCRIPTION =
                  (ADDRESS = (PROTOCOL = TCP)(HOST =server.amazonaws.com)(PORT =1521))
                  (CONNECT_DATA =
                    (SERVER = DEDICATED)
                    (SID =devid)
                  )
                )
                `
};

结果错误:

 Errorrrrrrrrr:  Cannot read properties of undefined (reading '_getConnection')

答案#1

请检查您的连接,希望您只创建了一个连接,因为 mongojs 是