Sequelize for DB2 for Linux, Unix, and Windows
Version Compatibility
See Releases to see which versions of DB2 for LUW are supported.
To use Sequelize with DB2 for LUW, you need to install the @sequelize/db2
dialect package:
- npm
- Yarn
- pnpm
npm i @sequelize/db2
yarn add @sequelize/db2
pnpm add @sequelize/db2
Then use the Db2Dialect
class as the dialect option in the Sequelize constructor:
import { Sequelize } from '@sequelize/core';
import { Db2Dialect } from '@sequelize/db2';
const sequelize = new Sequelize({
dialect: Db2Dialect,
database: 'mydb',
user: 'myuser',
password: 'mypass',
hostname: 'localhost',
port: 50000,
ssl: true,
});
Connection Options
Connection Options are used to configure a connection to the database.
The simplest way to use them is at the root of the configuration object. These options can also be
used in the replication
option to customize the connection for each replica,
and can be modified by the beforeConnect
hook on a connection-by-connection basis.
The following options are accepted by the DB2 for LUW dialect:
Option | Description |
---|---|
database | ODBC "DATABASE" parameter |
username | ODBC "UID" parameter |
password | ODBC "PWD" parameter |
hostname | ODBC "HOSTNAME" parameter |
port | ODBC "PORT" parameter |
ssl | Sets ODBC "Security" parameter to SSL when true |
sslServerCertificate | ODBC "SSLServerCertificate" parameter |
odbcOptions | Additional ODBC parameters. |