Preview Support for IBM DB2 is Now Available in RepoDB

We are excited to announce the preview release of IBM DB2 support for RepoDB — bringing our hybrid ORM’s fluent CRUD, raw-SQL, and Bulk Operations capabilities to DB2 for the first time, right out of the gate.

What’s in this preview?

The new RepoDb.DB2 package brings the full RepoDB experience to DB2:

It follows the same programming model you already use with our SQL Server, PostgreSQL, MySQL, SQLite, and Oracle extensions — the same fluent API, the same lightweight philosophy, now targeting DB2.

Why DB2?

DB2 continues to power a large share of enterprise and mainframe-adjacent systems, and it has consistently been one of the most requested providers from the community. This preview closes that gap, so teams running on DB2 can get the same fast, hybrid data-access experience — and now, the same high-throughput Bulk Operations — that RepoDB is known for on other providers.

Getting started

Install the packages:

> Install-Package RepoDb.DB2
> Install-Package RepoDb.DB2.BulkOperations

Then follow the Get Started with DB2 tutorial to wire it up in your application.

Basic CRUD

Insert

using var connection = new DB2Connection(connectionString);
var customer = new Customer { Name = "John Doe", Address = "New York" };
var id = connection.Insert(customer);

Query

using var connection = new DB2Connection(connectionString);
var customer = connection.Query<Customer>(e => e.Id == 10045).FirstOrDefault();

Update

using var connection = new DB2Connection(connectionString);
var customer = connection.Query<Customer>(e => e.Id == 10045).FirstOrDefault();
customer.Address = "California";
var updatedRows = connection.Update(customer);

Delete

using var connection = new DB2Connection(connectionString);
var deletedRows = connection.Delete<Customer>(10045);

Merge

using var connection = new DB2Connection(connectionString);
var customer = new Customer { Id = 10045, Name = "John Doe", Address = "Washington" };
var id = connection.Merge(customer, qualifiers: e => e.Id);

Raw-SQL

ExecuteQuery

using var connection = new DB2Connection(connectionString);
var customers = connection.ExecuteQuery<Customer>("SELECT * FROM Customer WHERE Address = @Address;",
    new { Address = "California" });

ExecuteNonQuery

using var connection = new DB2Connection(connectionString);
var affectedRows = connection.ExecuteNonQuery("UPDATE Customer SET Address = @Address WHERE Id = @Id;",
    new { Address = "Washington", Id = 10045 });

ExecuteScalar

using var connection = new DB2Connection(connectionString);
var count = connection.ExecuteScalar<int>("SELECT COUNT(*) FROM Customer;");

Bulk Operations

BulkInsert

using var connection = new DB2Connection(connectionString);
var customers = GetCustomersToInsert();
var insertedRows = connection.BulkInsert(customers);

BulkUpdate

using var connection = new DB2Connection(connectionString);
var customers = GetCustomersToUpdate();
var updatedRows = connection.BulkUpdate(customers);

BulkMerge

using var connection = new DB2Connection(connectionString);
var customers = GetCustomersToMerge();
var mergedRows = connection.BulkMerge(customers, qualifiers: e => e.Id);

BulkDelete

using var connection = new DB2Connection(connectionString);
var customers = GetCustomersToDelete();
var deletedRows = connection.BulkDelete(customers);

BulkDeleteByKey

using var connection = new DB2Connection(connectionString);
var keys = new[] { 10045, 10046, 10047 };
var deletedRows = connection.BulkDeleteByKey<Customer>(keys);

Why Bulk Operations matter

The fluent CRUD operations above are great for row-by-row or small-batch work, but they still cost one round-trip per call. When you are moving thousands (or millions) of rows — a nightly import, a data migration, a catch-up sync — that per-row overhead adds up fast. Bulk Operations push the batching down to the driver/server boundary, so you get:

  • Fewer round-trips — a single call moves the entire set instead of one call per row
  • Lower CPU and network overhead — less serialization/deserialization chatter between your app and DB2
  • Consistent behavior across providers — the same BulkInsert, BulkUpdate, BulkMerge, BulkDelete, and BulkDeleteByKey calls you already use for SQL Server, PostgreSQL, MySQL, and Oracle now work against DB2 too, so migrating workloads between providers doesn’t mean rewriting your data-access layer
  • Predictable throughput at scale — ideal for ETL jobs, backfills, and any workload where dataset size — not row count per call — is the bottleneck

A preview, not a final release

As a preview package, RepoDb.DB2 (and its Bulk Operations counterpart) is still maturing — APIs and behavior may change before a stable release ships. We would love to hear your feedback as you try it out; it directly shapes what we prioritize on the way to general availability.

Please support us

Give a ⭐ to our Github repository | Follow me at X / Twitter | Connect with us at our official Teams Channel
Apache License 2.0 — Copyright © 2026 by Michael Camara Pendon / Create a Request