X

The leading edge of scripting languages and Oracle Database brought to you by the Data Access Development team

node-oracledb 2.1 is now available from npm

Christopher Jones
Senior Principal Product Manager

Release announcement: Node-oracledb 2.1.0, the Node.js module for accessing Oracle Database, is on npm.

Top features: Privileged connections such as SYSDBA. A new 'queryStream()' Stream 'destroy()' method

After the big refactoring of node-oracledb 2.0, we're pleased to push node-oracledb forward with the release of 2.1.0.

 

Changes in node-oracledb 2.1.0 include:

  • Support for SYSDBA, SYSOPER, SYSASM, SYSBACKUP, SYSDG, SYSKM, and SYSRAC privileges in standalone connections. You can now connect like:

    oracledb.getConnection(
      {
        user: 'sys',
        password: 'secret',
        connectString: 'localhost/orclpdb',
        privilege: oracledb.SYSDBA
      },
      function(err, connection) {
        if (err)
          console.error(err);
        else
          console.log('I have power');
      }
      // . . .
    );
    
  • The internal implementations of 'direct fetches' and 'queryStream()' have been simplified by reusing the ResultSet changes of 2.0. You might notice speedups in some cases.

  • The 'queryStream()' result Stream now supports Node 8's destroy() method, which obsoletes the previous experimental '_close()' method of node-oracledb.

    If you are using '_close()' in Node 8 or later, you should:

    • Change the method name from '_close()' to 'destroy()'.

    • Stop passing a callback.

    • Optionally pass an error.

  • Improved the Error object with new 'errorNum' and 'offset' properties. The properties will be included when you get errors from Oracle Database such as this:

        connection.execute(
          "select wrong_col from departments",
          function(err, result) {
            if (err)
              console.error(err);
            else
              console.log(result.rows);
          });
        

    The output is:

    { Error: ORA-00904: "WRONG_COL": invalid identifier errorNum: 904, offset: 7 }
    

    The offset is relative to the start of the SQL statement. For non SQL errors, the offset will be 0.

  • New 'versionSuffix' and 'versionString' properties to the oracledb object to aid showing the release status and version. The 'versionSuffix' attribute will be an empty string for production releases, but may be something like '-dev' or '-beta.1' for other builds.

    The existing 'version' attribute is great for runtime comparisons, but not as handy as the new 'versionString' attribute for displaying to users.

  • With a code contribution from Sagie Gur-Ari an annoying little gotcha was fixed. Now 'connectionString' is an alias for 'connectString'.

    oracledb.getConnection(
      {
        user: 'hr',
        password: 'welcome',
        connectionString: 'localhost/orclpdb',
      },
      function(err, connection) {
        if (err)
          console.error(err);
        else
          console.log('I am HR');
      }
    );
    
  • The underlying data access layer ODPI-C had some improvements which flow through to node-oracledb.

    • Connections can now be closed when ResultSets and Lobs are open. This removes the DPI-1054 error you might have seen if you closed resources in the 'wrong' order.

    • At connection close there is no longer an unconditional rollback sent to the database. Instead ODPI-C makes use of some internal state to avoid the overhead of the 'round trip' to the database when it is known that there is no open transaction.

  • Node-oracledb 2.1 no longer compiles with the long-obsolete Node 0.10 or 0.12 versions. We'd stopped testing and claiming support for these versions a while back, but technically compilation had been possible until now. Updates to NAN API usage and other cleanups have lead to this change.

  • Our testing and documentation improved, as always.

See the CHANGELOG for other changes in node-oracledb 2.1

Finally, you may be interested to know about these cool new resources:

Resources

Node-oracledb installation instructions are here.

Node-oracledb documentation is here.

Node-oracledb change log is here.

For information on migrating see Migrating from node-oracledb 2.0 to node-oracledb 2.1.

Issues and questions about node-oracledb can be posted on GitHub.

Finally, contributions to node-oracledb are more than welcome, see CONTRIBUTING.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.