Node-oracledb: Error in oracle read: Error: NJS-018: invalid ResultSet

Created on 9 Nov 2020  路  4Comments  路  Source: oracle/node-oracledb

  1. What versions are you using?
  1. Describe the problem
  1. Include a runnable Node.js script that shows the problem.
oracledb.getConnection(conString).then(function (connection) {//then(Promise.promisifyAll).
    var options = { outFormat: oracledb.OUT_FORMAT_OBJECT };
    options.resultSet = true;
    connection.execute(sql, [], options).then(function (result) {
      var retStream = result.resultSet.toQueryStream().on('error', function (error) {
        //
        connection.release().catch(
          function (err) {
            var errMsg = izError.getMessage('ECONNECTIONCLOSE', { moduleName: 'Oracle Read' });
            logger.log('error', errMsg);
            parseStream.emit('error', "Error in connection close: " + err);//ask to sir
          });
        //
        readStream.emit('error', "Error in oracle read: " + error);
      }).on('end', function () {
        connection.release().catch(
          function (err) {
            var errMsg = izError.getMessage('ECONNECTIONCLOSE', { moduleName: 'Oracle Read' });
            logger.log('error', errMsg);
            parseStream.emit('error', "Error in connection close: " + err);//ask to sir
          });
      });

    }, function (err) {
      var errMsg = izError.getMessage("EREAD", { moduleName: 'Oracle Read' });
      logger.log('error', errMsg + err);
      readStream.emit("error", errMsg); // 0.3
    });
  }, function (err) {
    var errMsg = izError.getMessage("ECONNECTION", { moduleName: 'Oracle Read' });
    logger.log('error', errMsg + err.stack);
    readStream.emit("error", errMsg); // 0.3
  });

I have updated my node from 8.9.4 to 14.15.0 and after that facing this issue while reading data.

question

Most helpful comment

Thanks @anthony-tuininga for your response, it worked well.

All 4 comments

Some things to try:

  • review the current documentation and examples. There were changes in recommendations at some stage.
  • If this doesn't help, then update your question with a complete script that we can actually run.

node-oracledb 5.0.0 will work with 11g or not?

Yes, node-oracledb 5.0.0 will work with 11g. Also, change the on('end') to on ('close') in the snippet above. Take a look at the note in the release notes for 4.1.0 -- that mentions that the connection should only be closed in the 'close' event and not in the 'end' event -- based on recommendations from Node.js which clarified the behavior of these events in version 10 if I recall correctly. :-)

Thanks @anthony-tuininga for your response, it worked well.

Was this page helpful?
0 / 5 - 0 ratings