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

node-any-jdbc

v1.0.6

Published

JDBC wrapper for any DataBase

Readme

node-any-jdbc

This module connects to any RDBMS such as Oracle, Vertica, Teradata, MySql etc. and executes any type of SQL statement on target database. You just need the the Xjdbc.jar of your target RDBMS to bridge the connection. One common method execute() for all purpose. That's all there is to it.!

Installation

JDK: Install JDK 1.8. All the tests work out of the box on a 1.8+ JVM. JDK is require just as a bridge between Node.JS and your target RDBMS. Install if your machine does not have JDK 1.8+.

Xcode: MAC users, ensure you have Xcode installed. This is required for compiling native addon modules for Node.js.

Windows Build Tool: (follow below steps if your OS is Windows)

Although it is not necessary, but before you install the windows specific build tools, make sure you uninstall other `microsoft visual c++ 2005 redistributable` software from the machine. You can install it afterwards if require a specific version for other purpose.

💡 [Windows Vista / 7 only] requires .NET Framework 4.5.1 (Currently not installed automatically by this package) Download and install it from [here](https://www.microsoft.com/en-us/download/details.aspx?id=40773)

Install all the required tools and configurations using Microsoft's windows-build-tools from an elevated PowerShell or CMD.exe (run as Administrator).

Note: If you are behind a specific corporate proxy, then you need to set some environment variables: ` setx NODE_TLS_REJECT_UNAUTHORIZED 0 `

npm install -g node-gyp

npm install -g --add-python-to-path --production windows-build-tools

Wait for build tool to be installed and once done exit from that shell, launch another elevated PowerShell or CMD.exe (run as Administrator)

npm config set msvs_version 2015

Post Installation

MAC OSX users, there should not be any issues in installing all the dependent modules particularly jdbc modules. If jdbc module is not installed under the node_modules folder then you may require to install build tool node-gyp which can be found here and follow the above step again.

Windows users, if the Microsoft's windows-build-tools are installed properly then you may see jdbc module under the node_modules folder. If jdbc module is not available after installation then there might be some problem with the Microsoft's windows-build-tool. Check the console log for the specific error. Follow the steps again or refer to the document here and also here to install it manually if require.

Example

execute(config, sqlQuery, callback);

execute a SQL query on any RDBMS and gives query results set
@param {*} config - db connection strings
@param {*} sqlQuery - sql queries to execute
@param {callback} callback function that contains query results and gets called when the command finishes


var db = require('node-any-jdbc');

//example of Oracle connection string

oracleCogfig = {
  libpath: './config/drivers/oracle/ojdbc7.jar',
  drivername: 'oracle.jdbc.driver.OracleDriver',
  url:  'jdbc:oracle:thin:QA/password123@//abc-test.corp.int:1527/stage1',
  // uri: 'jdbc:oracle:thin://abc-test.corp.int:1527/stage1',
  // user: 'QA',
  // password: 'password123',
};

//example of mysql connection string

var cogfig = {
  libpath: './config/drivers/mysql/mysql-connector-java-5.0.8-bin.jar',
  drivername: 'com.mysql.jdbc.Driver',
  uri: 'jdbc:mysql://localhost/employee_database',
  user: 'root',
  password: 'root123'
};

//example of sample select query to fetch the result set

var sql = 'SELECT * FROM emp_info where emp_id = "1001"';
db.execute(cogfig, sql, function(results){
  console.log(results);
});

//example of create TABLE

db.execute(cogfig, 'CREATE TABLE test(ID INTEGER, TEXT VARCHAR(255)), function(err){
  console.log(err);
  assert.equal(err, null);

});

//example of INSERT TABLE

var sql = 'INSERT INTO emp_info (emp_id, emp_name, emp_dept, location) VALUES (1009, "Chandra", "IT", "CA")';
db.execute(cogfig, sql, function(){
  db.execute(cogfig, 'SELECT * FROM emp_info where emp_id = 1009', function(results){
    console.log(results);
  });
});

Note: You don't require to close the connection explicitly. It is being handled by the execute() method.

For more info on how to use xjdbc.jar, db connection string and example etc. please refer to the sample example under /config and /test/specs

Contribution

Create a fork of the project into your own repository. Make all your necessary changes and create a pull request with a description on what was added or removed and details explaining the changes in lines of code. If approved, project owners will merge it.

Licensing

MIT