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

Error on oracledb version 6 upgrade: "NJS-021: invalid type for conversion specified" #1654

Closed
ghc20 opened this issue Mar 20, 2024 · 3 comments
Labels

Comments

@ghc20
Copy link

ghc20 commented Mar 20, 2024

  1. What versions are you using?
    oracledb version 6
  1. Is it an error or a hang or a crash?
    Yes

  2. What error(s) or behavior you are seeing?
    NJS-021: invalid type for conversion specified

  1. Include a runnable Node.js script that shows the problem.
connection.execute(sql, params,
        { fetchInfo: { DATA: { type: oracledb.STRING}}, outFormat: oracledb.OUT_FORMAT_OBJECT},
        (err, res) => {
          if (err) {
              console.error('Failed to get session.');
              console.error(err);
              return cb && cb(err, null);
          }
...
        }}

The above code works well with oracledb version 5 and earlier versions. However, following an upgrade to oracledb version 6, an error occurs: "NJS-021: invalid type for conversion specified". This error pertains to the "DATA" column, which is of LOB type. Upon debugging, it was identified that the problem arises from the fetchInfo: { DATA: { type: oracledb.STRING }} configuration. This configuration functions correctly in version 5 but leads to errors in version 6.

Any advice is appreciated! Thank you!

@ghc20 ghc20 added the bug label Mar 20, 2024
@sharadraju
Copy link
Member

sharadraju commented Mar 20, 2024

@ghc Thanks for using node-oracledb.
Node-oracledb 6.0 comes with a default 'Thin' mode, which eliminates the need to use Oracle Client libraries to connect to Oracle Database. See https://medium.com/oracledevs/usher-in-a-new-era-with-the-node-oracledb-6-0-pure-javascript-thin-driver-e10e2af693b2
The Thick mode retains the old behavior of pre 6.0 versions and uses Oracle Client libraries to connect to Oracle Database. See How to enable Thick mode.
Please check the same application by enabling Thick mode and let us know the results. This will help us in fixing the problem quickly.

@ghc20
Copy link
Author

ghc20 commented Mar 20, 2024

@sharadraju I enabled the Thick mode with oracledb.initOracleClient({libDir: 'C:\\Oracle\\instantclient_21_10'}) in my code. The same error persists :-(

@ghc20
Copy link
Author

ghc20 commented Mar 20, 2024

@sharadraju I identified the issue: multiple Node.js libraries in my project are using different versions of oracledb, leading to the problem. Thank you!

@ghc20 ghc20 closed this as completed Mar 20, 2024
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

2 participants