joeferner / node-oracle

node.js driver to connect with an oracle database.
MIT License
271 stars 99 forks source link

ORA-12514: TNS:listener does not currently know of service requested in connect descriptor #178

Open ewu1209 opened 10 years ago

ewu1209 commented 10 years ago

Does anyone know why I am receiving this error message? I am successfully able to connect to this database using Navicat or SqlDeveloper using the exact same parameters. I am also successfully able to connect to a different database using different connection string parameters.

var sys = require('sys'); var oracle = require('oracle');

var connectData = { hostname: "11.6.309.144", port: 1521, database: "FF234J", // System ID (SID) user: "BLAHUSERNAME", password: "BLAHPASSWORD"
};

exports.dumpData = function (req, res) { var sql = "SELECT * from BEATS where rownum < 3";

oracle.connect(connectData, function(err, connection) { if (err) { console.log("Error connecting to db:", err); return; } connection.execute(sql, [], function(err, results) { if (err) { console.log("Error executing query:", err); return; } res.json(results); connection.close(); }); });

};

gchristiansen commented 9 years ago

The value for the database field needs to be the service_name, not SID. Basically the listener on the database server does not know about the service named "FF234J" in your example. You can get a list of services that your listener knows about by logging on to the database server and issuing the "lsnrctl status" command

ewu1209 commented 9 years ago

Awesome, thank you for the response.