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

Upgrading from 5.5.0 to latest 6 version #1675

Closed karkan20 closed 1 month ago

karkan20 commented 1 month ago

Title: Error NJS-516 when Upgrading from 5.5.0 to 6.0 or 6.5.1 in Thin Mode

Using Node.js 20 framework.

Describe the problem:

I am trying to upgrade the version of my project from 5.5.0 to 6.0.0 or 6.5.1 major versions. However, I encounter an error when creating a pool:

NJS-516: no configuration directory set or available to search for tnsnames.ora

I'm not sure what is missing. As per my understanding, configdir is an optional parameter for thin mode.

I have tried the examples provided in the repository, but they are more or less the same for thin mode and do not resolve the issue.

Steps to reproduce:

  1. Upgrade the project version from 5.5.0 to 6.0.0 or 6.5.1.
  2. Attempt to create a pool in thin mode

Actual behavior:

The error NJS-516: no configuration directory set or available to search for tnsnames.ora

Can anyone help to understand what could be missing from dbconfig?

anthony-tuininga commented 1 month ago

What is in your database configuration? The connect string is important in particular. Note that if you are upgrading from 5.5.0 you can also add a call to oracledb.initOracleClient() which will enable thick mode -- which should work in the same way as 5.5.0 did.

karkan20 commented 1 month ago

connectstring = "service_name" Where service_name databasename.

sharadraju commented 1 month ago

@karkan20 If you are using LDAP, LDAP is not supported in node-oracledb's default Thin mode. You will have to use the Thick mode.

However, the documentation is missing, which we will update. Thanks for bringing this to our attention!

karkan20 commented 1 month ago

It is working for thin mode in 5.5.0 version. So if I want to upgrade to 6.0.0 I need to use thick mode?

sharadraju commented 1 month ago

Node-oracledb 5.5 does not have a 'Thin' mode. It relied on Oracle Instant Client libraries.

The Thin mode was introduced in node-oracledb 6.0 to remove the dependency on Oracle Instant Client libraries. Please see the node-oracledb 6.0 release announcement

However, we created an optional Thick mode to enable the use of Oracle Client libraries for the features which are not supported in Thin mode . Please see https://node-oracledb.readthedocs.io/en/latest/user_guide/appendix_a.html#oracle-database-features-supported-by-node-oracledb.

Unfortunately, LDAP support is not available in Thin mode now, but we are planning to add it in a future release.

So for now, if you are using LDAP, Thick mode is required.

karkan20 commented 1 month ago

With 5.5.0 version, I am not calling oracledb.initOracleClient() in my database.js before creating the pool. Still it worked so my understanding is if I do not call initOracleclient then it's in thin mode..

sharadraju commented 1 month ago

@karkan20 Please let us know your platform and if you are using LDAP? Does your platform have Oracle Client libraries installed?

The Oracle Client libraries will automatically be picked up from PATH libraries (in Windows) or LD_LIBRARY_PATH (in Linux) and this does not require initOracleClient() function to be called.

karkan20 commented 1 month ago

Windows platform

On Fri, May 24, 2024, 11:07 AM Sharad Chandran R @.***> wrote:

@karkan20 https://github.com/karkan20 Please let us know your platform and if you are using LDAP?

— Reply to this email directly, view it on GitHub https://github.com/oracle/node-oracledb/issues/1675#issuecomment-2129771361, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOKVGXEHTDKNNOPWVV2C6UTZD5JSZAVCNFSM6AAAAABIHMYJTWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRZG43TCMZWGE . You are receiving this because you were mentioned.Message ID: @.***>

sharadraju commented 1 month ago

Ok, then your Instant Client Libraries would have been picked from your PATH environment variable in node-oracledb 5.5. So you did not need initOracleClient() then.

Please check https://node-oracledb.readthedocs.io/en/latest/user_guide/installation.html#installing-node-js-and-node-oracledb-on-microsoft-windows.

karkan20 commented 1 month ago

Ok so what I understand is before 6.0 version if we don't call specifically initOracleclient and if there is client library available in the oracle home path then it will do the connection.

But post 6.0 release as thin mode being default mode, we have to specifically mention initoracleclient for ldp connection to work.

sharadraju commented 1 month ago

Ok so what I understand is before 6.0 version if we don't call specifically initOracleclient and if there is client library available in the oracle home path then it will do the connection.

But post 6.0 release as thin mode being default mode, we have to specifically mention initoracleclient for ldp connection to work.

Yes.

karkan20 commented 1 month ago

Thanks for clearing out.