Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NJS-110 when using type defined as TABLE OF VARCHAR2(xxx CHAR) in thin mode #1646

Closed
Xamo1297 opened this issue Feb 23, 2024 · 4 comments
Closed
Labels

Comments

@Xamo1297
Copy link

  1. What versions are you using?

Oracle Database 19.3
process.platform : win32
process.version: v20.10.0
process.arch x64
require('oracledb').versionString: 6.3.0
require('oracledb').oracleClientVersionString: 19.3.0.0.0 (in thick mode)

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

  2. What error(s) or behavior you are seeing?
    NJS-110: invalid Oracle type number 1 [csfrm: 129]

  3. Include a runnable Node.js script that shows the problem.

SQL:

CREATE OR REPLACE TYPE "TABLE_OF_VARCHAR2_CHAR" AS TABLE OF VARCHAR2(100 CHAR);
CREATE OR REPLACE TYPE "TABLE_OF_VARCHAR2_BYTE" AS TABLE OF VARCHAR2(100 BYTE);

Javascript:

const oracledb = require('oracledb');

async function test() {
    try {
        const connection = await oracledb.getConnection({
            user          : "user",
            password      : "pwd",
            connectString : "server/service"
        });

        try {
            try {
                await connection.getDbObjectClass("TABLE_OF_VARCHAR2_CHAR");
                console.log("Success with TABLE_OF_VARCHAR2_CHAR");
            } catch (error) {
                console.error(`Error "${error}" for TABLE_OF_VARCHAR2_CHAR`);
            }
            try {
                await connection.getDbObjectClass("TABLE_OF_VARCHAR2_BYTE");
                console.log("Success with TABLE_OF_VARCHAR2_BYTE");
            } catch (error) {
                console.error(`Error "${error}" for TABLE_OF_VARCHAR2_BYTE`);
            }
        } finally {
            await connection.close();
        }
    } catch (error) {
        console.error(`Error ${error} connecting`);
    }
}

test();

Result using thin mode:

Error "Error: NJS-110: invalid Oracle type number 1 [csfrm: 129]" for TABLE_OF_VARCHAR2_CHAR
Success with TABLE_OF_VARCHAR2_BYTE

Result using thick mode:

Success with TABLE_OF_VARCHAR2_CHAR
Success with TABLE_OF_VARCHAR2_BYTE
@Xamo1297 Xamo1297 added the bug label Feb 23, 2024
@sudarshan12s
Copy link

Thanks @Xamo1297 for informing. This will be fixed in the upcoming 6.4.0 release.

@sudarshan12s
Copy link

There is a patch something below which is missing in 6.3, It will be officially released as part of 6.4 with other related changes..

diff --git a/lib/thin/connection.js b/lib/thin/connection.js
index c671c1da..c1613f54 100644
--- a/lib/thin/connection.js
+++ b/lib/thin/connection.js
@@ -273,6 +273,8 @@ class ThinConnectionImpl extends ConnectionImpl {
         oraTypeNum = (attrType === constants.TNS_OBJ_TDS_TYPE_VARCHAR) ?
           constants.TNS_DATA_TYPE_VARCHAR : constants.TNS_DATA_TYPE_CHAR;
         csfrm = buf.readUInt8();
+        csfrm = csfrm & 0x7f;
+        buf.skipBytes(2);
         info.elementType = types.getTypeByOraTypeNum(oraTypeNum, csfrm);
         break;
       case constants.TNS_OBJ_TDS_TYPE_RAW:

@sharadraju
Copy link
Member

@Xamo1297 This has been fixed in node-oracledb 6.4. Please confirm.

@Xamo1297
Copy link
Author

@Xamo1297 This has been fixed in node-oracledb 6.4. Please confirm.

It works correctly with v6.4, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants