案例1:
connectString = (DESCRIPTION =(地址=(PROTOCOL = TCP)(HOST = dev.xyz.net)(PORT = 1521))(CONNECT_DATA =(SERVICE_NAME = pdb_qa12c)))
案例2:
connectString = dev.xyz.net:1521/pdb_qa12c
是否出于某种原因,下面的代码仅适用于情况1 而不适用于情况2 ,下面是一段代码,
var oracledb = require('oracledb');
oracledb.getConnection(
{
user : "user",
password : "pass",
connectString : "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dev.xyz.net)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=pdb_qa12c)))"
},
function(err, connection) {
if (err) {
console.error("Receieved Error: ", err.message);
return;
}
console.log('Connection was successful!');
connection.close(
function(err) {
if (err) {
console.error("Got Error: ", err.message);
return;
}
});
});
我遇到了案例2 中的错误,
ORA-12154: TNS:could not resolve the connect identifier specified