var oracledb = require('oracledb');
oracledb.getConnection({
user : "SYSTEM",
password : "*************",
connectstring : "localhost/XE"
},
function(err, connection)
{
if(err){
console.error(err.message);
return;
}
connection.execute(
"SELECT department_id, department_name "
+ "FROM table1 ",
function(err, result){
if(err){
console.error(err.message);
doRelease(connection);
return;
}
console.log(result.metadata);
console.log(result.rows);
doRealease(connection);
});
});
function doRealease(connection){
connection.close(
function(err){
if(err){
console.error(err.message);
}
});
}
此代码显示错误:ORA-12560: TNS:protocol adapter error
我不确定连接字符串是什么以及问题出在哪里。终端显示:[nodemon] clean exit - waiting for changes before restart