node.jsexpressnode-oracledb

Is there a way to use the Node.js oracledb library without editing my PATH variable?


I am trying to build a web interface with Node.js to show data from an Oracle database at work. I did some research and found that I will need oracledb to be able to access it. Any installation guide I find says I need to edit my PATH variable to use it.

I don't have admin rights to my work pc, so is there any way around this? Is there a way maybe to make a temp PATH for one instance of the command line I am running? Any work around is appreciated.


Solution

  • Update With node-oracledb 6 you no longer need the Oracle Client libraries. By default the driver is a pure JavaScript implementation. You don't need to change PATH. See the release announcement.

    With node-oracledb 5 on Windows and macOS you can set the location of the Oracle Client libraries by calling initOracleClient() without needing to do any external configuration. This is all documented:

    const oracledb = require('oracledb');
    try {
      oracledb.initOracleClient({libDir: 'C:\\oracle\\instantclient_19_6'});
    } catch (err) {
      console.error('Whoops!');
      console.error(err);
      process.exit(1);
    }
    

    There is only one installation guide. Did you have difficulty finding it? Do you have any suggestions for improvements?