我成功地将DBeaver连接到Oracle Database Express Edition 11g
但是当我想与nodeJS连接时
我的代码是
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();```
答案 0 :(得分:0)
您需要将lsnrctl status
的结果发送给我们
尝试localhost:1521:XE