node-oracledb icon indicating copy to clipboard operation
node-oracledb copied to clipboard

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

Open singhlaanshul87 opened this issue 3 months ago • 3 comments

  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);
}
})();

singhlaanshul87 avatar Sep 29 '25 14:09 singhlaanshul87

Please let us know more details about your database setup? Is it NNE enabled? Does this happen only from node-oracledb 6.9? What was your previous node-oracledb version?

sharadraju avatar Sep 29 '25 14:09 sharadraju

Please let us know more details about your database setup? Is it NNE enabled? At DB side it is TDE ( Transparent data encryption )

[oracle@hlnpkxvvvb91 ~]$ cd $ORACLE_HOME/network/admin/
[oracle@hlnpkxvvvb91  admin]$ cat sqlnet.ora
# sqlnet.ora.hlnpkxvvvb91  Network Configuration File: /u01/app/18.0.0.0/grid/network/admin/sqlnet.ora.hlnpkxvvvb91 
# Generated by Oracle configuration tools.
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
SQLNET.EXPIRE_TIME=10
SQLNET.ALLOWED_LOGON_VERSION_SERVER = 8
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
ENCRYPTION_WALLET_LOCATION =
  (SOURCE =(METHOD = FILE)(METHOD_DATA = (DIRECTORY = +DATAC1/oracle/wallets/$ORACLE_UNQNAME )))
BREAK_POLL_SKIP=10000
DISABLE_OOB=ON

Does this happen only from node-oracledb 6.9? What was your previous node-oracledb version? It happens with 6.7/6.8/6.9

singhlaanshul87 avatar Sep 29 '25 14:09 singhlaanshul87

@singhlaanshul87 Does this also happen with thick mode? Can you please share the output after setting the environment variable NODE_ORACLEDB_DEBUG_PACKETS to 1(or any value).

sreguna avatar Sep 30 '25 04:09 sreguna