Skip to main content
Version: v7 - alpha

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 i @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:

OptionDescription
databaseODBC "DATABASE" parameter
usernameODBC "UID" parameter
passwordODBC "PWD" parameter
hostnameODBC "HOSTNAME" parameter
portODBC "PORT" parameter
sslSets ODBC "Security" parameter to SSL when true
sslServerCertificateODBC "SSLServerCertificate" parameter
odbcOptionsAdditional ODBC parameters.