Hi ,
I am trying to connection to a remote Oracle server from Node Js code . I am trying to use TNS connection string instead of conventional configuration connection string. I am using following but getting "ORA-01017: invalid username/password; logon denied" error. Could anyone help me with this error? Following is my code for connection
var express = require('express');
var object_to_xml = require('object-to-xml');
var router = express.Router();
var db;
var dataQuery= "select * from movie";
router.use('/', function(req, res, next) {
var connString = "(DESCRIPTION =(LOAD_BALANCE = ON)(FAILOVER = ON)(ADDRESS =(PROTOCOL = TCP)(HOST = server1)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = server2)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=XE)(FAILOVER_MODE=(TYPE=SELECT)(METHOD = BASIC))))";
var config = { "tns": connString,"user": "scott", "password": "tiger" };
db = require('oracledb');
db.outFormat = db.OBJECT;
console.log(config);
db.getConnection( config,function(err, connection)
{
if (err) {
console.error(err.message);
return;
}
connection.execute( dataQuery, function(err, results)
{
if (err) {
console.error(err.message);
return;
}
res.send(object_to_xml(results));
});
});
});
module.exports = router;
but when I am trying to connect to any of the server mentioned in the host from SQLDeveloper then I am able to connect correctly.