npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

oracledb-autoreconnect

v2.0.6

Published

Autoreconnect for Oracle official NodeJS driver.

Downloads

7

Readme

Autoreconnect for Oracle official NodeJS driver

This library is wrapper with additional features, that uses Oracle official NodeJS driver on background.

Additional features

  • Auto-connect. So just call sql query and does not care of anything else.
  • Auto-reconnect if connection get lost.
  • Promises, that official driver don't have. :-)

Installation

npm install oracledb-autoreconnect

Installation Prerequires

Because this small library is only wrapper for Oracle official NodeJS driver, so please read Installing node-oracledb or Installing node-oracledb - extended version.

NOTE: If you will have some issues, try (as test) install npm install oracledb and solve, why it fails.

Example using library

// Include this library

var db = require('oracledb-autoreconnect');


// Set connection parameters on application init.

db.setConnection({
    user          : "hr",
    password      : "welcome",
    connectString : "localhost/XE"
});


// Just make query anytime.
// Don't care about connect to db. It is solved automatically.

var queryString = "SELECT id, firstname, lastname FROM db.persons WHERE firstname LIKE :1 AND lastname LIKE :2";
var queryParams = ["John","Brown"];
db.query(queryString, queryParams).then(function (dbResult) {

    // Convert result to better structured object
    var assocDbResult = db.transformToAssociated(dbResult);
    
    // Print results to console
    assocDbResult.map(function(person) {
        console.log(person.firstname + " " + person.lastname + " has id " + person.id);
    });
});

API of library

function setConnection(oracledbConnectionObject)

Configuration of server connection parameters and credentials for future use in autoconnection/reconnection.

Note: Object with parameters will be pushed directly into Oracle library into official oracledb.getConnection method.

  • @returns {undefined} - Does return nothing

function query(query, queryParams)

Makes SQL query with autoconnection and reconnection on error If oracle DB is not connected yet, method will try to connect automatically. If DB is connected, but connection is lost (connection timeout), method will automatically try to reconnect.

  • @param {String} query - SQL query
  • @param {Array} queryParams - Array of values to SQL query
  • @returns {Promise} - Result of SQL query

function transformToAssociated(sqlResult)

Converts common SQL SELECT result into Array of rows with associated column names.

Example:

Input:
{
    metaData: [{name:"ID"},{name:"FIRSTNAME"}],
    rows: [[1, "JOHN"],[2,"JARYN"]]
}
Converted output:
[
    {"ID":1, "FIRSTNAME":"JOHN"}
    {"ID":2, "FIRSTNAME":"JARYN"}
]
  • @param {Object} sqlSelectResult
  • @returns {Array.<Object.<string,*>>}

function connect()

Manual create connection to Oracle server. If already connected to server, it does NOT connect second one, but use the first one. NOTE: In common use in not necessary to call.

  • @returns {Promise} - Oracledb connection object of official Oracledb driver

function disconnect()

Manual disconnect from DB.

NOTE: In common use in not necessary to call.

  • @returns {Promise}

object oracledb

Exports the whole oracledb library.

  • @type {object}