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

NJS-112 error thrown when changing port on oracledb 6.0.0 #1556

Closed Thibaut-Mouton closed 1 year ago

Thibaut-Mouton commented 1 year ago

Hello ! First of all thank you for this amazing feature which will save me a lot of time. However I encounter a somewhat strange error when I try to connect to my Oracle DB.

  1. What versions are you using?

Note : it's working fine on my PC with the following configuration :

  1. Is it an error or a hang or a crash?

I got an error : when changing the default Oracle port (I changed it to 1522), connection is impossible and I see the message below. When I set the default port in the connection string (I tried with another Oracle DB), the connexion is established successfullly.

  1. What error(s) or behavior you are seeing ?
Error: NJS-112: internal error: read integer of length 64 when expecting integer of no more than length 4
    at Object.throwErr (/opt/app/node_modules/oracledb/lib/errors.js:588:10)
    at ReadPacket._readInteger (/opt/app/node_modules/oracledb/lib/thin/protocol/buffer.js:100:14)
    at ReadPacket.readUB4 (/opt/app/node_modules/oracledb/lib/thin/protocol/buffer.js:491:17)
    at ReadPacket._readBytesWithLength (/opt/app/node_modules/oracledb/lib/thin/protocol/packet.js:160:36)
    at ReadPacket.readBytesWithLength (/opt/app/node_modules/oracledb/lib/thin/protocol/buffer.js:364:17)
    at ReadPacket.readStr (/opt/app/node_modules/oracledb/lib/thin/protocol/buffer.js:463:22)
    at AuthMessage.processReturnParameter (/opt/app/node_modules/oracledb/lib/thin/protocol/messages/auth.js:308:21)
    at AuthMessage.processMessage (/opt/app/node_modules/oracledb/lib/thin/protocol/messages/base.js:213:12)
    at AuthMessage.process (/opt/app/node_modules/oracledb/lib/thin/protocol/messages/base.js:196:12)
    at AuthMessage.decode (/opt/app/node_modules/oracledb/lib/thin/protocol/messages/base.js:187:10) {
  code: 'NJS-112'
}
  1. Include a runnable Node.js script that shows the problem.

I use this sample with nodejs in command line :

const oracle = require('oracledb')
const connection = await oracle.getConnection({user:'XXXXX',password:'XXXXX',connectString:'(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=XXXXXX)(PORT=1522))(CONNECT_DATA=(SID=XXXXXX)))'})

Could you help me ? In advance, thank you for your help !

anthony-tuininga commented 1 year ago

Are you able to share the packet trace by setting the environment variable NODE_ORACLEDB_DEBUG_PACKETS to any value before running your script? I only need the last one sent and received.

anthony-tuininga commented 1 year ago

Wait. I don't think I need it, actually. Thin mode doesn't support Oracle Database 11g. You will have to enable thick mode for that database. An error should be raised for this condition but clearly isn't!

sharadraju commented 1 year ago

Hi, @Thibaut-Mouton. Thank you for trying our new release. However, node-oracledb 6.0 Thin mode supports only Oracle Database versions 12.1 and later. https://node-oracledb.readthedocs.io/en/latest/user_guide/installation.html Oracle Database 11g is not supported :)

sharadraju commented 1 year ago

Hi, @Thibaut-Mouton. Thank you for trying our new release. However, node-oracledb 6.0 Thin mode supports only Oracle Database versions 12.1 and later. https://node-oracledb.readthedocs.io/en/latest/user_guide/installation.html Oracle Database 11g is not supported :)

Oops, @anthony-tuininga beat me to it :)

Thibaut-Mouton commented 1 year ago

Oh indeed I double check my nodejs compatibility with oracledb but I forgot to check the DB version compatibility, which is indeed a few versions behind :) Sorry for this false problem I'll close the issue and try with thick mode ! Have a nice day

cjbj commented 1 year ago

We'll improve the error message in this scenario.