Preview Support for IBM DB2 is Now Available in RepoDB

4 minute read

Published:

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

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

    // Query
    var queriedCustomer = connection.Query<Customer>(e => e.Id == id).FirstOrDefault();

    // Update
    queriedCustomer.Address = "California";
    var updatedRows = connection.Update(queriedCustomer);

    // Delete
    var deletedRows = connection.Delete<Customer>(id);

    // Merge
    var mergedCustomer = new Customer { Id = id, Name = "John Doe", Address = "Washington" };
    var mergeResult = connection.Merge(mergedCustomer, qualifiers: e => e.Id);
}

Raw-SQL

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

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

    // ExecuteScalar
    var count = connection.ExecuteScalar<int>("SELECT COUNT(*) FROM Customer;");
}

Bulk Operations

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

    // BulkUpdate
    var customersToUpdate = GetCustomersToUpdate();
    var updatedRows = connection.BulkUpdate(customersToUpdate);

    // BulkMerge
    var customersToMerge = GetCustomersToMerge();
    var mergedRows = connection.BulkMerge(customersToMerge, qualifiers: e => e.Id);

    // BulkDelete
    var customersToDelete = GetCustomersToDelete();
    var deletedRows = connection.BulkDelete(customersToDelete);

    // BulkDeleteByKey
    var keysToDelete = new[] { 10045, 10046, 10047 };
    var deletedByKeyRows = connection.BulkDeleteByKey<Customer>(keysToDelete);
}

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