Knex dialect for IBM DB2
npm install @morgul/knex-db2**⚠️ Disclaimer ⚠️: This library should be considered 'beta' quality. This work is currently being done as an
exploratory project with my currently employer, and may be dropped at any time.**
npm install @morgul/knex-db2
shell
arch -x86_64 /bin/zsh
`
Then you can install the library as normal. (You will need to run your application in x86_64 mode as well.)
Dependencies
npm install knex
Usage
This library is written in typescript and compiled to both commonjs and esm:
`javascript
// Require is supported
const knex = require('knex');
const { DB2Dialect } = require('@morgul/knex-db2');
// Or as ESM
import knex from 'knex';
import { DB2Dialect } from '@morgul/knex-db2';
const db = knex({
client: DB2Dialect,
connection: {
host: 'localhost',
database: 'knextest',
port: 50000,
user: '',
password: '',
connectionStringParams: {
ALLOWPROCCALLS: 1,
CMT: 0,
},
},
pool: {
min: 2,
max: 10,
},
});
const query = db.select('*').from('table').where({ foo: 'bar' });
query
.then((result) => console.log(result))
.catch((err) => console.error(err))
.finally(() => process.exit());
`
or as Typescript
`typescript
import { knex } from 'knex';
import { DB2Dialect, DB2Config } from '@morgul/knex-db2';
const config: DB2Config = {
client: DB2Dialect,
connection: {
host: 'localhost',
database: 'knextest',
port: 50000,
user: '',
password: '',
connectionStringParams: {
ALLOWPROCCALLS: 1,
CMT: 0,
},
},
pool: {
min: 2,
max: 10,
},
};
const db = knex(config);
const query = db.select('*').from('table').where({ foo: 'bar' });
query
.then((result) => console.log(result))
.catch((err) => console.error(err))
.finally(() => process.exit());
``