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

knex-db2

v1.0.0

Published

Knex dialect for DB2

Readme

npm version Build Status Known Vulnerabilities dependencies Status devDependencies Status

Disclaimer: this library is in early stages of development. Use at your own risk. Please submit an issue for any bugs encounter or any questions you have.

Description

This is an external dialect for knex.

Limitations

Currently this dialect has limited functionality compared to the Knex built-in dialects. Below are some of the limitations:

  • No transaction support
  • No streaming support
  • Possibly other missing functionality

Supported functionality

Installing

npm install knex-db2

Requires Node v6 or higher.

Dependencies

npm install odbc see ODBC dependencies if you run into any issues

npm install knex

Usage

const Knex = require('knex')
const Db2Dialect = require('knex-db2')

const knex = Knex({
	client: Db2Dialect,
	connection: {
		host: 'localhost',
		database: 'knextest',
		port: 50000,
		user: 'db2inst1',
		password: 'db2inst1-pwd',
		driver: '{IBM Cli Driver}',
		connectionStringParams: {
			ALLOWPROCCALLS: 1,
			CMT: 0
		}
	},
	pool: {
		min: 2,
		max: 10
	}
})

const query = knex
	.select('*')
	.from('table1')
	.where('x', 'y')


query
	.then(result => console.log(result))
	.catch(err => console.error(err))
	.finally(() => process.exit())

ODBC dependencies

  • make: sudo apt install make
  • g++: sudo apt install g++
  • unix odbc: sudo apt-get install unixodbc unixodbc-dev

Configuring your driver

If you don't know the name of your installed driver, then look in look in odbcinst.ini. You can find the full path of the file by running odbcinst -j. There you should see an entry like the one below:

[IBM i Access ODBC Driver 64-bit]       <= driver name enclosed in square brackets
Description=IBM i Access for Linux 64-bit ODBC Driver
Driver=/opt/ibm/iaccess/lib64/libcwbodbc.so
Setup=/opt/ibm/iaccess/lib64/libcwbodbcs.so
Threading=0
DontDLClose=1
UsageCount=1

If that still doesn't work, then unixodbc is probably looking for the config files in the wrong directory. A common case is that the configs are in /etc but your system expects them to be somewhere else. In such case, override the path unixodbc looks in via the ODBCSYSINI and ODBCINI environment variables. E.g., ODBCINI=/etc ODBCSYSINI=/etc.

Installing default driver

Download driver

https://github.com/ibmdb/node-ibm_db#-download-clidriver-based-on-your-platform--architecture-from-the-below-ibm-hosted-url

Install driver

  • Extract downloaded file. This will create a clidriver folder with the driver contents
  • Copy this folder to wherever your system keeps drivers. If you're not sure where to put it, just copy it to /opt/ibm.
  • Add the configuration your /etc/odbcinst.ini file. Below is what the contents of the file should look like if your odbc path is /opt
[IBM Cli Driver]
Description=IBM CLI Driver for Linux 64-bit
Driver=/opt/ibm/clidriver/lib/libdb2.soSetup=libdb2.so.1
hreading=0
DontDLClose=1
UsageCount=1