expressjs oracledb {[错误:ORA-12514:TNS:侦听器当前不知道连接描述符中请求的服务] errorNum:12514,偏移量:0}

时间:2019-03-24 10:07:21

标签: node.js oracle express oracledb

我成功地将DBeaver连接到Oracle Database Express Edition 11g

successfully

但是当我想与nodeJS连接时 error

我的代码是

const oracleApp = express();

const oracledb = require('oracledb');
const config = {
  user: 'TEST',
  password: 'TEST',
  connectString: 'localhost:1521/XE'
};


async function getStudents() {
  let conn;
  try {
    conn = await oracledb.getConnection(config);
    const result = await conn.execute(
      'select * from students'
    );
    console.log(result.rows[0]);
  } catch (err) {
    console.log('Ouch!', err);
  } finally {
    if (conn) { // conn assignment worked, need to close
      await conn.close();
    }
  }
}

getStudents();```

1 个答案:

答案 0 :(得分:0)

您需要将lsnrctl status的结果发送给我们

尝试localhost:1521:XE