oracle / node-oracledb

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

Not able to initialize client when running with specific group (sg command) #1531

Closed Alankarsharma closed 1 year ago

Alankarsharma commented 1 year ago
  1. What versions are you using? process.platform: linux process.version: v18.9.0 process.arch: x64 require('oracledb').versionString: 5.3.0 require('oracledb').oracleClientVersionString: 21.8.0.0.0
    1. Include a runnable Node.js script that shows the problem. const oracledb = require('oracledb'); oracledb.initOracleClient({libDir: 'path to instant client folder'})
cjbj commented 1 year ago

This is a limitation of the client libraries on Linux. It's documented in https://oracle.github.io/node-oracledb/doc/api.html#oracleclientloadinglinux :

Note on Linux initOracleClient() is only useful to force immediate loading of the libraries because the libraries must also be in the system library search path, i.e. configured with ldconfig or set in LD_LIBRARY_PATH, before Node.js is started.

Alankarsharma commented 1 year ago

LD_LIBRARY_PATH is also set. If I run following code even then behavior is exactly same. const oracledb = require('oracledb'); oracledb.initOracleClient();

anthony-tuininga commented 1 year ago

How is LD_LIBRARY_PATH set? If it is not set before the process starts it has no effect.

Alankarsharma commented 1 year ago

I have set it in command line before running program. Have verified value also in program by printing it on console log.

cjbj commented 1 year ago

Show us exactly how you set the variable.

Do you have the nnz file? Do you have any permissions issues?

Alankarsharma commented 1 year ago

export LD_LIBRARY_PATH=/data/instantclinet (I have renamed original instantclient_21_8 to instantclient) This is how LD_LIBRARY_PATH is set. On same terminal session I am running 'node test.js' and 'sg groupabc -c "node test.js"' commands.

cjbj commented 1 year ago

I've not played with sg but anything like that has a good chance of not propagating environment settings. Try using ldconfig as recommended in the node-oracledb installation instructions.

Alankarsharma commented 1 year ago

What's the default folder location where it will search? I will try to create a link and test.

Alankarsharma commented 1 year ago

Tried with ldconfig, it worked. Thanks.