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.
Some things to try:
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.
Most helpful comment
Thanks @anthony-tuininga for your response, it worked well.