I am using oracledb in my Node server for connecting to a TNS Connection Alias. This is my code:
const oracledb = require('oracledb');
oracledb.getConnection(
{
user: "test",
password: "test",
connectString: "ADMISSIONS"
},
function (err, connection) {
if (err) {
logger.error("Error is: " + err.message);
callback(null, err);
return;
} else {
logger.loud("Connection successful!");
}
});
}
However, I am getting this error:
TNS:could not resolve the connect identifier specified
I am sure my connectString
is wrong. Can anyone please help with what should be the value of connectString
if I want to connect to a TNS Connection Alias called Admissions ? Please note this is NOT a localhost/XE connection.
The issue was outdated tnsnames.ora
file. I copied the latest version of tnsnames.ora
file into my /etc
directory and the connection is successful. Thanks to @Malice