docs/databases/db2.mdx
:::info 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,
});
import ConnectionOptions from './_connection-options.md';
<ConnectionOptions />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. |