Skip to content

NJS-500: Connection to Oracle database closed or broken (Thin mode, oracle sql developer works fine) #1754

@singhlaanshul87

Description

@singhlaanshul87
  1. What versions are you using?
    We are using Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.26.0.0.0.
    We are using Node JS 16.13.2
    We are using node-oracledb 6.9.0
  1. Is it an error or a hang or a crash?
    We are observing a connection failure while connecting to an Oracle Database using the node-oracledb Thin mode driver.

  2. What error(s) or behavior you are seeing?

  • Oracle SQL developer connects successfully and runs queries.
  • Node.js (Thin Mode) consistently fails with NJS-500.
  • Error is recoverable but occurs immediately on connect.
Error: NJS-500: connection to Oracle Database was closed or broken
NJS-501: connection to host 100.11.117.80 port 1526 terminated unexpectedly. (CONNECTION_ID=kvQcRheRWVTpjgf8xoMOHWaDw==)
write EPIPE
    at NTTCP.checkErr (/opt/app-root/node_modules/oracledb/lib/thin/sqlnet/ntTcp.js:336:29)
    at NTTCP.receive (/opt/app-root/node_modules/oracledb/lib/thin/sqlnet/ntTcp.js:472:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async NetworkSession._recvPacket (/opt/app-root/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:434:22)
    at async NetworkSession.connect2 (/opt/app-root/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:233:22)
    at async NetworkSession.connect1 (/opt/app-root/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:336:23)
    at async NetworkSession.connect (/opt/app-root/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:623:5)
    at async ThinConnectionImpl.connect (/opt/app-root/node_modules/oracledb/lib/thin/connection.js:828:5)
    at async Object.getConnection (/opt/app-root/node_modules/oracledb/lib/oracledb.js:788:3)
    at async Object.getConnection (/opt/app-root/node_modules/oracledb/lib/util.js:298:16) {
  code: 'NJS-500',
  isRecoverable: true
}
  1. Include a runnable Node.js script that shows the problem.
const oracledb = require('oracledb');
(async ()=> {
try {
const conn = await  oracledb.getConnection({
   user: process.env.USER,
   password: process.env.PASS,
   connectString: "abcrkb01n.abc.com:1526/BEXU_ABCRKB01n_TEST"
});
const result = await conn.execute("Select 1 from dual");
console.log(result.rows);
await conn.close();
} catch (e) {
   console.error(e);
}
})();

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions