Currently, I am working on a project which requires the backend to be done in oracle
. I used the given link and installed the node-oracledb using npm on my mac. My file contents are as follows
var oracledb = require('oracledb');
oracledb.getConnection(
{
user : 'username',
password : 'password',
connectString : 'username/password//hostname:port/sid'
function(err, connection)
{
if (err) {
console.error(err.message);
return;
}else{
connection.execute(
"SELECT * from TableName",
function(err, result)
{
if (err) { console.error(err); return; }
console.log(result.rows);
});
}
});
When I run node filename.js I get the following error
ORA-12154: TNS:could not resolve the connect identifier specified
I am using node version is v7.0.0
and npm version is v3.10.8
. Also my oracle database is a 11g
instance on the cloud. Can somebody let me know as to what am I doing wrong?