Skip to content

Question why getting Error: NJS-046: poolAlias "xxxPool" already exists in the connection pool cache #987

@rstor1

Description

@rstor1

Answer the following questions:

  1. What is your Node.js version? Is it 64-bit or 32-bit? Run version.js from https://github.com/oracle/node-oracledb/blob/master/examples/version.js

Node.js version: 6.9.1, 64-bit

  1. What is your node-oracledb version?

Node-oracledb version: 2.3.0

  1. What exact command caused the problem (e.g. what command did you try to install with)? Who were you logged in as?

npm run start

  1. What error(s) you are seeing?
    screen shot 2018-10-01 at 3 14 13 pm

  2. What OS (and version) is Node.js executing on?

MacOS version: 10.13.6

  1. What is your Oracle client (e.g. Instant Client) version? Is it 64-bit or 32-bit? How was it installed? Where is it installed?

screen shot 2018-10-01 at 3 04 34 pm

  1. What is your Oracle Database version?

I am not sure, I just tried to use this guide: https://oracle.github.io/node-oracledb/INSTALL.html#instosx and although the app runs and I can debug, I get the error above.

  1. What is the PATH environment variable (on Windows) or LD_LIBRARY_PATH (on Linux) set to? On macOS, what is in ~/lib?

screen shot 2018-10-01 at 3 00 18 pm

  1. What Oracle environment variables did you set? How exactly did you set them?

I am not sure exactly

  1. Do you have a small, single Node.js script that immediately runs to show us the problem?
    Unfortunately no but here is some code:

Top of my oracle.js file with create pool function (code formatting not working here for me so using screenshot):
screen shot 2018-10-01 at 3 39 21 pm

Connect:
` connect() {

var connAttrs = (this.creds.poolAlias) ? this.creds.poolAlias : this.creds;

return oracledb.getConnection(connAttrs)
  .catch((err) => {

    debug('connect failed');
    if (_.isUndefined(this.creds.poolAlias)) {
      throw new Error(err);
    }
    else {
      return this._catchPoolErr(err, this.creds.poolAlias)
        .then(() => {
          this.connect();
        });
    }
  });

},`

Try to createPool if does not exist:
` _catchPoolErr(err, poolAlias) {

// connection pool not found. create and reconnect  
if (err.toString().match('NJS-047')) {
  debug(`connection pool ${poolAlias} not found. Will request creation`);
  return this.createPool(poolAlias);
}
else {
  throw new Error(err);
}

}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions