ibm_db (CLI/ODBC)RdsDb2Dialect extends DB2Dialect and inherits all of itsrdsadmin.* stored procedures called from therdsadmin database; the commands they replace are refused; and TLS uses a| Property | Value |
|---|---|
| Dialect name | rdsdb2 |
| Extends | DB2Dialect |
| Driver | ibm_db — no extra package |
| Default port | 50000 (non-SSL); the SSL port is SSL_SVCENAME |
| Auth | Password (no Kerberos, no IAM) |
| Cloud SDK | none |
| Local runtime | none — hosted service only |
$ npm install ts-prorm-orm ibm_db$ pnpm add ts-prorm-orm ibm_db$ yarn add ts-prorm-orm ibm_db$ bun add ts-prorm-orm ibm_dbibm_db is the same driver the db2 dialect uses.import { Prorm } from 'ts-prorm-orm';
export const db = new Prorm({
dialect: 'rdsdb2',
host: 'db2.abc123.us-east-1.rds.amazonaws.com',
database: 'TESTDB',
username: 'admin',
password: process.env.DB_PASSWORD,
});import { Prorm } from 'ts-prorm-orm';
export const db = new Prorm({
dialect: 'rdsdb2',
url: 'rdsdb2://admin:secret@db2.abc123.us-east-1.rds.amazonaws.com:50000/TESTDB',
});host, port, database, username and password before the dialect is built; any of those passed alongside it wins.import { DataTypes } from 'ts-prorm-orm';
const User = db.define('User', {
id: { type: DataTypes.INTEGER(), primaryKey: true, autoIncrement: true },
email: { type: DataTypes.STRING(255), allowNull: false, unique: true },
name: { type: DataTypes.STRING(100) },
});
await db.sync(); // CREATE TABLE — see Generated SQL belowimport { Op } from 'ts-prorm-orm';
await User.create({ email: 'ada@example.com', name: 'Ada' });
const page = await User.findAll({
where: { name: { [Op.like]: 'A%' } },
order: [['id', 'ASC']],
limit: 20,
offset: 40,
});query(), captured with the driver stubbed out. The model layer inlines the values.db.sync() for the model in the Quick start:CREATE TABLEawait User.create({ email: 'ada@example.com', name: 'Ada' });
await User.update({ name: 'Grace' }, { where: { email: 'ada@example.com' } });
await User.destroy({ where: { id: 1 } });await User.upsert({ id: 1, email: 'ada@example.com', name: 'Ada Lovelace' });MERGE statementupsert() also reads the row by primary key before and after the write, to return the instance.await User.findAll({
where: { name: { [Op.like]: 'A%' } },
order: [['id', 'ASC']],
limit: 20,
offset: 40,
});await db.transaction(async (t) => {
await User.create({ email: 'grace@example.com', name: 'Grace' }, { transaction: t });
// A nested transaction is a SAVEPOINT; its failure undoes only its own work.
await db
.transaction(async (sp) => {
await User.destroy({ where: { id: 1 }, transaction: sp });
throw new Error('keep the row');
}, { transaction: t })
.catch(() => {});
});STRING → VARCHAR(255), auto-increment INTEGER → INTEGER, BOOLEAN → BOOLEAN, DATE → TIMESTAMP, UUID → CHAR(36), JSON → CLOB. The type comparison lines the major engines up side by side.const db = new Prorm({
dialect: 'rdsdb2',
host: 'db2.abc123.us-east-1.rds.amazonaws.com',
database: 'TESTDB',
username: 'admin',
password: process.env.DB_PASSWORD,
dialectOptions: {
tls: { port: 50443, caPath: '/etc/ssl/rds/global-bundle.pem' }, // or $PRORM_RDS_CA_BUNDLE
},
});DB2COMM to TCPIP,SSL (or SSL)SSL_SVCENAME to a port in a custom parameter group. With tls, theSECURITY=SSL;SSLServerCertificate=<bundle>connect() first checks theCloudAuthError INVALID_CONFIG with the downloadRdsDb2Dialect extends DB2Dialect (db2) andObject.getOwnPropertyNames(RdsDb2Dialect.prototype),| Area | Overridden |
|---|---|
| Connection and execution | connect, query |
| DML builders | buildSetArchiveLogRetentionCall, buildUpdateDbParamCall |
| DDL and schema | buildAddGroupsCall, buildAddUserCall, buildCreateDatabaseCall, buildCreateRoleCall, buildDbadmGrantCall, buildDbadmRevokeCall, buildDropDatabaseCall, buildDropRoleCall, buildGrantRoleCall, buildRevokeRoleCall, createDatabaseSQL, dropDatabaseSQL |
| Introspection | assertAllowedOnRds, isRdsadmin |
| Other | buildActivateDatabaseCall, buildBackupDatabaseCall, buildChangePasswordCall, buildCompleteRollforwardCall, buildDeactivateDatabaseCall, buildForceApplicationCall, buildGetTaskStatusSql, buildListUsersCall, buildReactivateDatabaseCall, buildRemoveGroupsCall, buildRemoveUserCall, buildRestoreDatabaseCall, buildRollforwardDatabaseCall, buildRollforwardStatusCall, dbadmCall, forRdsadmin, runRdsadmin |
rdsadmin.* procedures must be called while connected to therdsadmin database as the master user. forRdsadmin() returns a dialectrunRdsadmin(call) refuses to run? output marker as an ibm_dbOUTPUT parameter:const admin = (db.dialect as RdsDb2Dialect).forRdsadmin();
await admin.connect();
await admin.runRdsadmin(admin.buildCreateDatabaseCall({ database: 'SALES', pageSize: 8192 }));
await admin.query(admin.buildGetTaskStatusSql({ database: 'SALES' })); // tasks are asynchronousquery() runs assertAllowedOnRds() first, also on the command text insideSYSPROC.ADMIN_CMD('...'):| Command | Use instead (from rdsadmin) |
|---|---|
CREATE DATABASE / DROP DATABASE (also createDatabaseSQL() / dropDatabaseSQL()) | rdsadmin.create_database / drop_database |
BACKUP DATABASE | rdsadmin.backup_database (to S3) |
RESTORE DATABASE | rdsadmin.restore_database (from S3) |
ROLLFORWARD DATABASE | rdsadmin.rollforward_database |
UPDATE DB CFG | rdsadmin.update_db_param |
UPDATE DBM CFG | DB parameter group |
FORCE APPLICATION | rdsadmin.force_application |
ACTIVATE / DEACTIVATE DATABASE | rdsadmin.activate_database / deactivate_database |
GRANT/REVOKE DBADM, ACCESSCTRL, DATAACCESS ON DATABASE | rdsadmin.dbadm_grant / dbadm_revoke (needs SECADM otherwise) |
anything granting SECADM | Not available to any RDS user |
GRANT CONNECT ... ON DATABASE, GRANT ROLE ...), DDL andADMIN_CMD('REORG ...') are unaffected.{ sql, values } — values is [] or the single OUTPUT| Builder | Procedure |
|---|---|
buildCreateDatabaseCall | create_database(name, page_size, code_set, territory, collation, autoconfigure, non_restrictive) |
buildDropDatabaseCall | drop_database(name) |
buildActivateDatabaseCall / buildDeactivateDatabaseCall / buildReactivateDatabaseCall | (?, name) |
buildUpdateDbParamCall | update_db_param(name, parameter, value[, restart]) |
buildBackupDatabaseCall | backup_database(?, name, bucket, prefix, ONLINE|OFFLINE[, compression, util_impact_priority, num_files, parallelism, num_buffers]) |
buildRestoreDatabaseCall | restore_database(?, name, bucket, prefix, timestamp, ONLINE|OFFLINE) |
buildRollforwardDatabaseCall | rollforward_database(?, name, bucket, prefix, END_OF_LOGS|END_OF_BACKUP|ts, TRUE|FALSE) |
buildRollforwardStatusCall / buildCompleteRollforwardCall | (?, name) |
buildForceApplicationCall | force_application(?, 'ALL' | 'h1, h2') |
buildSetArchiveLogRetentionCall | set_archive_log_retention(?, name, hours) — 0–840, not on rdsadmin |
buildAddUserCall / buildChangePasswordCall / buildRemoveUserCall / buildListUsersCall | user management |
buildAddGroupsCall / buildRemoveGroupsCall | (username, 'g1,g2') |
buildCreateRoleCall | create_role(database, role) |
buildGrantRoleCall / buildRevokeRoleCall / buildDropRoleCall | (?, database, role[, grantee[, admin_option]]) |
buildDbadmGrantCall / buildDbadmRevokeCall | (?, database, 'DBADM,ACCESSCTRL,DATAACCESS', grantee) |
buildGetTaskStatusSql | SELECT ... FROM TABLE(rdsadmin.get_task_status(id, database, type)) |
capabilitiesOf() (src/transaction-support.ts),whereSupportOf() (src/query-builders/expression-render.ts),sqlObjectCapabilitiesOf() (src/sql-objects/capabilities.ts) and the| Capability | rdsdb2 |
|---|---|
| Transactions atomic | yes |
| Savepoints | yes |
| Isolation | up to SERIALIZABLE; native levels UR, CS, RS, RR |
| Transaction modes | read-only no; deferrable no; constraint deferral no |
| RETURNING | not emitted; returning is accepted and ignored |
| Upsert | MERGE INTO … WHEN MATCHED / WHEN NOT MATCHED |
| JSON column | CLOB (JSONB → BLOB) |
| Vector column | VECTOR(3, FLOAT32) |
| Array column | VARCHAR(255) |
| WHERE builder | 32 operator keys; $and/$or/$not; $exists: yes; $in subquery: yes; expression operands: yes |
| SQL objects | family db2: triggers yes; procedures yes; functions multiStatement; materialized views native; sequences yes; enums check; RLS no |
| Streaming | queryStream() present; LISTEN absent; createExtension() present |
tests/dialects/rdsdb2.test.ts exercises the dialect with a mocked driver, so nothing touches a server.