oracle / node-oracledb

Oracle Database driver for Node.js maintained by Oracle Corp.
http://oracle.github.io/node-oracledb/
Other
2.24k stars 1.07k forks source link

Connection in thin mode does not work, but thick mode works fine. #1615

Closed volkmarbuehringer closed 8 months ago

volkmarbuehringer commented 9 months ago
  1. What versions are you using?
linux v20.8.0 x64 6.2.0 2. Is it an error or a hang or a crash? error 3. What error(s) or behavior you are seeing?
  1. Include a runnable Node.js script that shows the problem.

Connection in thin mode does not work, but in thick mode it works fine.

volkmarbuehringer commented 9 months ago

the errormessage thrown by the thin connection:

:{"type":"Error","message":"NJS-500: connection to the Oracle Database was broken\nNJS-521: connection to host 10.96.2.9 port 1521 received end-of-file on communication channel. (CONNECTION_ID=8CA8lEDOYPT7wmlU1TTt2g==)","stack":"Error: NJS-500: connection to the Oracle Database was broken\nNJS-521: connection to host 10.96.2.9 port 1521 received end-of-file on communication channel. (CONNECTION_ID=8CA8lEDOYPT7wmlU1TTt2g==)\n at NTTCP.checkErr (/home/prounix/projekte/azur/lotterie/services/js/transporter/node_modules/oracledb/lib/thin/sqlnet/ntTcp.js:327:29)\n at NTTCP.receive (/home/prounix/projekte/azur/lotterie/services/js/transporter/node_modules/oracledb/lib/thin/sqlnet/ntTcp.js:463:12)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async NetworkSession._recvPacket (/home/prounix/projekte/azur/lotterie/services/js/transporter/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:378:22)\n at async NetworkSession.recvPacket (/home/prounix/projekte/azur/lotterie/services/js/transporter/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:443:12)\n at async ReadPacket.waitForPackets (/home/prounix/projekte/azur/lotterie/services/js/transporter/node_modules/oracledb/lib/thin/protocol/packet.js:293:20)\n at async Protocol._decodeMessage (/home/prounix/projekte/azur/lotterie/services/js/transporter/node_modules/oracledb/lib/thin/protocol/protocol.js:70:5)\n at async Protocol._processMessage (/home/prounix/projekte/azur/lotterie/services/js/transporter/node_modules/oracledb/lib/thin/protocol/protocol.js:153:9)\n at async ThinConnectionImpl.connect (/home/prounix/projekte/azur/lotterie/services/js/transporter/node_modules/oracledb/lib/thin/connection.js:682:9)\n at async ThinPoolImpl.bgThreadFunc (/home/prounix/projekte/azur/lotterie/services/js/transporter/node_modules/oracledb/lib/thin/pool.js:420:11)","code":"NJS-500"},"msg":"Fehler bei db connect"}

volkmarbuehringer commented 9 months ago

by adding two lines I switch to thick mode and it works fine:

const clientOpts = { libDir: process.env.LD_LIBRARY_PATH }; oracledb.initOracleClient(clientOpts);

sharadraju commented 9 months ago

Thank you for testing! Was the connection working for you in node-oracledb 6.1 Thin mode?

Are you using Node.js v20.8?

volkmarbuehringer commented 9 months ago

No, 6.1 did not work either yes Node 20.8 Node v18.18.1 delivers the same error

sharadraju commented 9 months ago

That is odd... What is your Oracle DB version? I assume you are using Linux x86_64 for your app. Please provide us with a simple runnable test case.

sudarshan12s commented 9 months ago

Apart from DB version, If this issue is in test environment (no sensitive data to dump ) .., Can you also share the packet traces dumped on console which is enabled with NODE_ORACLEDB_DEBUG_PACKETS env (export NODE_ORACLEDB_DEBUG_PACKETS=1)

sreguna commented 9 months ago

@volkmarbuehringer Can you check if Native Network Encryption is enabled in your Oracle Database? Thin mode does not support this. A similar issue was reported in https://github.com/oracle/node-oracledb/discussions/1553

sharadraju commented 8 months ago

@volkmarbuehringer were you able to check if NNE is enabled in your Oracle Database? Please see @sreguna's comment

volkmarbuehringer commented 8 months ago

in sqlnet.ora I set:

SQLNET.CRYPTO_CHECKSUM_CLIENT = rejected

now I this error-message:

"level":50,"time":"2023-10-27T07:47:27.300Z","pid":13099,"hostname":"compi","err":{"type":"Error","message":"ORA-12660: Encryption or crypto-checksumming parameters incompatible","stack":"Error: ORA-12660: Encryption or crypto-checksumming parameters incompatible\n at async file:///home/prounix/projekte/azur/lotterie/services/js/transporter/conf/db.js:68:18","errorNum":12660,"offset":0,"code":"ORA-12660"},"msg":"Fehler bei db connect"}

I think this means that NNE is required and I have no way to disable it.

sharadraju commented 8 months ago

@volkmarbuehringer If NNE is required, the Thin mode does not support it yet. Please refer to the discussions section (#1553) .