Reputation: 171
I tried using the latest node-oracledb 6.0.1 thin mode to connect my simple Node.js app to my Oracle Database 11g version and got an NJS-138 error.
I ran the following simple app using node-oracledb 6.0.1 in Thin mode:
const oracledb = require('oracledb');
async function runApp() {
let connection;
let dbConfig = {
user : "scott",
password : "tiger",
connectString : "localhost/orclpdb"
};
//oracledb.initOracleClient();
// Get a standalone Oracle Database connection
connection = await oracledb.getConnection(dbConfig);
console.log('Connection was successful!');
// Run a simple SQL on the connection
const sql = `SELECT sysdate FROM dual`;
const result = await connection.execute(sql);
console.log(`The system date and time is:\n${result.rows[0][0]}`);
await connection.close();
if (oracledb.thin)
console.log("Thin mode selected");
else
console.log("Thick mode selected");
console.log("Run at: " + new Date());
console.log("Node.js version: " + process.version + " (" + process.platform, process.arch + ")");
console.log("Node-oracledb version:", oracledb.versionString);
}
runApp();
This gives the following error:
NJS-138: connections to this database server version are not supported by node-oracledb in Thin mode
Why is this error thrown?
Upvotes: 3
Views: 9208
Reputation: 1
const oracledb = require('oracledb');
oracledb.initOracleClient({libDir:'D:\\app\\client\\product\\12.2.0\\client_1'})
async function runApp() {
let connection;
let dbConfig = {
user : "User1",
password : "Userpassword",
connectString : "(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = XXX.XX.100.123)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = testprod)))"
};
//oracledb.initOracleClient();
// Get a standalone Oracle Database connection
connection = await oracledb.getConnection(dbConfig);
console.log('Connection was successful!');
// Run a simple SQL on the connection
const sql = `SELECT sysdate FROM dual`;
const result = await connection.execute(sql);
console.log(`The system date and time is:\n${result.rows[0][0]}`);
await connection.close();
if (oracledb.thin)
console.log("Thin mode selected");
else
console.log("Thick mode selected");
console.log("Run at: " + new Date());
console.log("Node.js version: " + process.version + " (" + process.platform, process.arch + ")");
console.log("Node-oracledb version:", oracledb.versionString);
}
runApp();
Upvotes: 0
Reputation: 171
node-oracledb 6.0 Thin mode supports Oracle Database Release 12.1 and later. Please see the following documentation: https://node-oracledb.readthedocs.io/en/latest/user_guide/appendix_a.html#id1 for the supported Oracle releases for both the Thin and Thick modes.
Node-oracledb 6.0 is a 'Thin mode' driver by default. You can switch to Thick mode for Oracle Database 11g support or upgrade your database version.
Upvotes: 3