简体   繁体   中英

connectString in oracledb node module

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM