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);
}
});
}
This code is showing an error: ORA-12560: TNS:protocol adapter error
I am not sure what the connectstring is and where the problem lies. The terminal shows: [nodemon] clean exit - waiting for changes before restart
You're referencing
connectstring
. It should beconnectString
- with a capitalS
.