Skip to content
Adapters

Db2 to PostgreSQL migration tools and converters compared on what actually lands

Ten ways to move an IBM Db2 database into PostgreSQL, judged on the rows that arrive. A popular converter maps exact DECFLOAT values to a binary FLOAT, AWS DMS ignores DECFLOAT changes once replication is running, and pgloader cannot connect to Db2 at all. All three are in the vendors' own documentation.

The live demo needs no card, and Starter is $49 a month.

Field mapping auto-plugged · tap a port to rewire

5 sample records ready

Vendor documentation read 2 October 2026

Which Db2 to PostgreSQL migration tool should you use?

For a one-time move of Db2 LUW 11.5 or older into RDS or Aurora PostgreSQL, use AWS SCT for the schema and DMS for the data. For SQL PL heavy schemas, use a code converter such as Ispirer or SQLines. For Db2 for z/OS, or for an ongoing sync while the application is rewritten, use a tool that captures changes on your platform and lets you declare the PostgreSQL columns. Whatever you pick, map every DECFLOAT to NUMERIC by hand before any data moves.

Four Db2 types and what a careless mapping turns them into in PostgreSQL, with DECFLOAT becoming an approximate FLOAT, a 12-digit timestamp rounding to 6, a 2 GB BLOB exceeding the 1 GB field limit, and the correct NUMERIC target. DB2 POSTGRESQL, CARELESS MAP DECFLOAT(34) TIMESTAMP(12) BLOB up to 2 GB DECFLOAT, again FLOAT binary, about 15 digits TIMESTAMP rounds to 6 digits BYTEA 1 GB field limit NUMERIC what to declare instead
Three mappings that look reasonable, and the correction for the one that changes money.

This route sits under our data migration tools guide. If the Db2 estate also has Oracle beside it, the same target with very different code rules is compared on Oracle to PostgreSQL migration tools.

Eight documented behaviors that change your data between Db2 and PostgreSQL

Each row sets a tool's documentation, or a type limit, against what IBM or PostgreSQL say about the same thing. The first two are about DECFLOAT, the type Db2 shops choose when a value must be exact in decimal, and they come from two of the names people trust most on this route.

Tool and setting What the documentation says Why it matters to a buyer What we would ship
SQLines, DECFLOAT The published mapping sends DECFLOAT(16 | 34) to FLOAT. IBM defines DECFLOAT as decimal floating point with 16 or 34 digits. PostgreSQL FLOAT is binary double precision with about 15. DECFLOAT is chosen precisely because it is exact in decimal. A DECFLOAT(34) balance becomes a binary approximation, and no value fails to load. NUMERIC, unconstrained
AWS DMS, DECFLOAT changes The DMS Db2 LUW page: "The DECFLOAT data type isn't supported. Consequently, changes to DECFLOAT columns are ignored during ongoing replication." The full load copies the column. Every later update to it is dropped, while the task reports healthy and the rest of each row stays current. Reconcile DECFLOAT at cutover
AWS DMS, DECFLOAT mapping Default mapping: "If precision is 16, then REAL8; if precision is 34, then STRING". REAL8 is an 8-byte binary float. Let DMS create the tables and one DECFLOAT column arrives as a float and another as text. Neither sorts or sums like the source. Pre-create the target DDL
AWS DMS, Db2 for z/OS Db2 for z/OS 12 is a supported source, but "Only Full Load replication tasks are supported. Change data capture (CDC) isn't supported." An IBM ODBC Connect license is required. Mainframe systems of record rarely stop for a weekend. Writes after the snapshot never reach PostgreSQL, and nothing reports them missing. Plan capture separately
AWS DMS and SCT, versions DMS supports Db2 LUW 11.5 only on Mods 0 to 8 with Fix Pack 0, and does not list 12.1. SCT lists LUW 9.1 through 11.5. Teams that upgraded to 12.1 to buy time on support find the standard AWS path does not list their version at all. Run db2level first
pgloader, Db2 source pgloader lists its source databases as SQLite, MySQL, MS SQL Server, PostgreSQL and Redshift. For IBM it reads IXF files only. pgloader is the free tool many PostgreSQL teams reach for first. Here it means an export of every table to IXF before anything loads. Budget an export step
Db2 TIMESTAMP(12) IBM: fractional seconds take "an attribute in the range from 0 to 12; the default is 6." PostgreSQL: "The allowed range of p is from 0 to 6." Columns at 7 to 12 digits round on load. Inside a unique key, two distinct Db2 values can become one PostgreSQL value and the second row fails. TIMESTAMP(6), check keys
Db2 BLOB and CLOB IBM: a BLOB or CLOB "can be up to 2 gigabytes minus 1 byte". PostgreSQL: maximum field size 1 GB. Large objects reach 4 TB. BYTEA and TEXT are the right targets for almost every row. The rare value above 1 GB fails the load, and it is usually a document someone needs. lo for oversized values

The second row is the one to take away. A DMS task that replicates a table with a DECFLOAT column copies it correctly in the full load, then ignores every later change to that one column while keeping the rest of the row current. The task stays green and the balance in PostgreSQL stops moving. If the plan is to keep PostgreSQL current from Db2 rather than move once, the capture options are compared in change data capture tools.

Db2 types in PostgreSQL, and the wrong target a careless map picks

A Db2 to PostgreSQL converter is mostly a type converter, and most of the work is easy. SMALLINT, INTEGER, BIGINT, DATE, VARCHAR and BOOLEAN cross unchanged. These twelve are the ones where the obvious choice, or the one a tool makes for you, is wrong.

Db2 type Right PostgreSQL target Common wrong target
DECFLOAT(16) NUMERIC FLOAT, which keeps about 15 binary digits
DECFLOAT(34) NUMERIC TEXT, or FLOAT with 19 digits gone
DECIMAL(p,s) NUMERIC(p,s) DOUBLE PRECISION from a generic mapper
TIMESTAMP(7) to (12) TIMESTAMP(6), keys checked TIMESTAMP with silent rounding
CHAR(n) FOR BIT DATA BYTEA CHAR(n), which converts the bytes
VARCHAR(n) FOR BIT DATA BYTEA VARCHAR(n) or TEXT
BLOB(n) BYTEA, lo above 1 GB BYTEA for a 2 GB value
CLOB(n), DBCLOB(n) TEXT, lo above 1 GB VARCHAR(n) sized from the LOB
GRAPHIC, VARGRAPHIC CHAR(n), VARCHAR(n) in UTF8 CHAR(2n), sized from the byte length
XML XML TEXT, which drops the well-formed check
Identity, GENERATED ALWAYS GENERATED ALWAYS AS IDENTITY SERIAL left at 1 after the load
TIME TIME(0) TIMESTAMP, which adds a date Db2 never stored

Two rows catch teams on shape rather than values. FOR BIT DATA tells Db2 the column is binary and, in IBM's words, that "code page conversions are not performed", so a loader that treats it as text runs bytes through a character set and either rejects them or changes them. Identity columns are the second: PostgreSQL refuses explicit values in a GENERATED ALWAYS column unless the insert says OVERRIDING SYSTEM VALUE, and after the load the sequence must be restarted above the highest key. The full per-type walkthrough, with a query to run on Db2 for each risky mapping, is in our guide to converting Db2 data types to PostgreSQL.

Db2 to PostgreSQL migration tools and converters compared

Billing units rather than price tags. Ispirer is the one vendor here that publishes license prices, by term and edition, alongside custom project estimates. Everything else is quoted, metered in ways that depend on your data, or has no license fee. Where a tool is wrong for a job, the last column says so, including for us.

Tool Approach Best for Billing unit What to watch
AWS SCT Schema and SQL PL conversion with an assessment report Planning a Db2 LUW move to RDS or Aurora No charge for the tool itself Lists LUW 9.1 to 11.5, not 12.1
AWS DMS Full load plus ongoing replication from Db2 LUW One-time moves inside AWS with a cutover date Replication instance hours or serverless capacity Ignores DECFLOAT changes in CDC
SQLines Converts DDL, queries and SQL PL, plus a data tool Procedure heavy schemas Licensed tools, quoted DECFLOAT to FLOAT by default
Ispirer Automated schema, data and code conversion for LUW, iSeries and z/OS Large estates with a services budget Published per-term licenses, custom estimates Review time drives the real cost
Microsoft converter AI-assisted Db2 LUW schema conversion for Azure PostgreSQL Teams moving to Azure Database for PostgreSQL Requested from the Azure team by email Db2 LUW only
db2topg Scripts that convert a schema dump and move data via CSV A DBA comfortable maintaining scripts GPL-3.0, no license fee Marked inactive by its authors
pgloader Bulk loader reading IXF export files Teams already exporting to IXF Open source, no license fee No live Db2 connection
Fivetran Managed Db2 for LUW and Db2 for i connectors Teams already on Fivetran Monthly active rows Metered as volume grows
Airbyte IBM Db2 source with full refresh and incremental syncs Teams running Airbyte already Self-hosted, or cloud credits Marketplace support level
Adapters Declared column mapping, incremental sync, per-record logs Typed PostgreSQL tables fed from Db2 on a flat bill Flat monthly from $49, no per-row overage fees Does not convert SQL PL

The two free rows deserve a second look, because they are where planning goes wrong. db2topg is the script set most PostgreSQL guides point to, and its own repository now says the project is inactive with no community support. pgloader is the loader PostgreSQL teams already know, and it reads Db2 data only as IXF export files. For what a cutover of this size costs once the tool is chosen, see what a data migration really costs, and for the same converter-default problem from another commercial engine, the SQL Server to PostgreSQL migration tools page.

Six numbers to know before you sign anything

30 Apr 2027

End of base support for Db2 11.5 on Linux, UNIX and Windows, all editions except Base Edition. Extended support runs to 30 April 2031.

IBM Db2 Distributed end of support dates, read 2 Oct 2026

34 vs 15

Decimal digits a DECFLOAT(34) holds exactly, against the roughly 15 a PostgreSQL double precision keeps in binary.

IBM Db2 docs and PostgreSQL manual, read 2 Oct 2026

12 vs 6

Fractional-second digits a Db2 TIMESTAMP can hold, against the most PostgreSQL keeps. Anything past six rounds.

IBM Db2 docs and PostgreSQL manual, read 2 Oct 2026

2 GB vs 1 GB

Largest Db2 BLOB or CLOB value, against PostgreSQL's maximum field size. Large objects go to 4 TB.

IBM Db2 docs and PostgreSQL manual, read 2 Oct 2026

Full load only

What AWS DMS offers from Db2 for z/OS. Change data capture from the mainframe is not supported.

AWS DMS Db2 for z/OS source page, read 2 Oct 2026

0

Live Db2 databases pgloader can read. It loads IXF export files, so every table needs an export first.

pgloader documentation, read 2 Oct 2026

Eight ways this migration goes wrong while every check stays green

Db2 and PostgreSQL agree on more than most pairs do. Both keep empty strings apart from NULL by default, both have real identity columns, both have MERGE. The trouble sits in the few places they disagree, where a value is legal on both sides and simply means something different after it lands.

The failure What you see What is actually happening
Balances drift Row counts match, sums are close DECFLOAT went to FLOAT, so exact decimal values became binary approximations on load.
One column goes stale Replication task healthy DMS ignores changes to DECFLOAT columns during ongoing replication, so only those values freeze.
Mainframe writes missing Full load completed Db2 for z/OS through DMS is full load only. Everything written after the snapshot never arrives.
Duplicate key on load A few rows rejected TIMESTAMP(12) values rounded to 6 digits and two distinct keys became one.
Binary keys garbled Encoding errors on some rows FOR BIT DATA was loaded as text, so bytes Db2 never converted went through a character set.
IDs collide after cutover First insert fails on the key The identity column was loaded but its sequence was never restarted above the highest value.
Blanks appear IS NULL counts drop Databases created with Oracle compatibility treat '' as NULL. PostgreSQL stores the blank.
XML stops validating Documents load as text A tool mapped XML to a text type, so malformed documents are now accepted without complaint.

Four of the eight are fixed in the DDL before the first row moves. The DECFLOAT replication gap and the mainframe snapshot are tool choices, and the identity restart belongs in the cutover runbook. If PostgreSQL is a stop on the way to reporting, the loading side is covered on Postgres ETL tools.

Six steps that decide whether this migration works

Step 1

Check the version and platform first

Run db2level and confirm whether the source is Db2 LUW, Db2 for i or Db2 for z/OS. The answer decides which tools are even on the table, because DMS, SCT and pgloader each cover a different slice.

Step 2

Inventory the risky types on Db2

One query against SYSCAT.COLUMNS lists every DECFLOAT, every TIMESTAMP above 6 digits, every FOR BIT DATA column, every LOB and every identity column. That list is the real scope.

Step 3

Write or correct the DDL by hand

Let SCT, SQLines or Ispirer generate a draft, then fix the types on this page: NUMERIC for DECFLOAT, TIMESTAMP(6) with key checks, BYTEA for bit data. Create the tables yourself rather than letting the loader guess.

Step 4

Turn on what capture needs

Log-based capture from Db2 LUW needs a recoverable database (LOGARCHMETH1 or LOGARCHMETH2 on) and DATA CAPTURE CHANGES on each table. That is a DBA change ticket, so raise it in week one.

Step 5

Full load, then keep PostgreSQL current

Load history once, then follow changes until the switch so cutover takes minutes. Check DECFLOAT columns separately if DMS is in the path, because their updates are not replicated.

Step 6

Reconcile values, then restart identities

Compare SUM on every numeric column, MIN and MAX on every timestamp and a hash of every key. Then restart each identity above its loaded maximum and insert one test row per table.

Step five is where a subscription earns its keep or does not. If the move is one weekend, DMS does it and you are done. If Db2 stays live for months while SQL PL is rewritten, you need the same mapping running every few minutes with DECFLOAT kept exact and a log of every record, which is what a flat Adapters plan covers with no per-row overage fees.

Why US teams fund this project

Beating the Db2 11.5 deadline

Base support for 11.5 ends 30 April 2027. Finance is asking whether to fund an upgrade, extended support or an exit, and PostgreSQL is the exit most teams price first.

Leaving IBM licensing

An application database that uses few Db2-specific features carries a license and support line that a managed PostgreSQL service on RDS, Aurora or Azure removes.

Feeding new apps from an IBM i ERP

Manufacturers and distributors keep the ERP on Db2 for i while a customer portal or warehouse app built on PostgreSQL needs its orders and inventory every few minutes.

Mainframe stays, services move

Insurers and banks keep Db2 for z/OS as the system of record and build new services on PostgreSQL, which then needs a steady, audited copy of policy or account data.

Moving to Aurora or Azure PostgreSQL

Teams already committed to a cloud move a Db2 LUW workload into a managed PostgreSQL engine, usually with the cloud vendor's converter for the schema and something else for ongoing data.

Running both during a long cutover

SQL PL rewrites take a quarter, not a weekend, so Db2 stays the system of record while PostgreSQL is kept current and checked against it until the switch.

Five jobs where you should not pick us

A comparison page that never says the competition wins is an advert. These are the cases where something else on this page is the right answer.

  • This is a one-time move of Db2 LUW 11.5 or older inside AWS with a fixed cutover date. SCT for the schema and DMS for the data is the documented path, it bills by the hour, and a subscription adds nothing once the switch is done.
  • Your schema is mostly SQL PL procedures, triggers and functions. That is a code conversion project. Ispirer, SQLines or a cloud vendor's converter are built for it, and we do not convert procedural code at all.
  • You need log-based capture from Db2 for z/OS at mainframe volumes. Tools built around the z/OS log are the right class for that job, and our scheduled sync is not.
  • You already run Fivetran with a Db2 connector and the bill is fine. Adding a PostgreSQL destination to a pipeline your team already operates is less work than adopting anything new.
  • You need sub-second latency from a Db2 commit to a PostgreSQL row. Streaming replication built for that will beat our scheduled sync.

Four questions to ask any vendor on this list

Question 01

Which Db2 platforms and versions do you read?

LUW, IBM i and z/OS are three different products with different logs. Ask for the exact versions supported, including 12.1, and whether change capture works on each or only a full load.

Question 02

What happens to DECFLOAT?

The fastest question on this route. A good answer is NUMERIC with exact values in both the load and the ongoing sync. FLOAT, DOUBLE, REAL8 or a text column tells you where reconciliation will fail.

Question 03

Can I see the DDL before anything loads?

Ask for the generated CREATE TABLE statements for your five riskiest tables. If the tool creates tables automatically at load time, you are accepting its defaults, and the table above lists what those tend to be.

Question 04

What does it cost when volume doubles?

Rows, credits and instance hours all grow with data. Ask for the bill at twice your current volume and during the month of the initial full load, which is often the most expensive month of the contract.

Questions buyers ask about Db2 to PostgreSQL migration

How do I migrate from Db2 to PostgreSQL?
Convert the schema with a tool that shows its type choices, then correct the DDL by hand: NUMERIC for every DECFLOAT, TIMESTAMP(6) where Db2 kept more digits, BYTEA for FOR BIT DATA and a plan for LOBs over 1 GB. Then run a full load, follow changes until cutover, and reconcile on values rather than row counts.
What is the best Db2 to PostgreSQL migration tool?
It depends on the job. AWS SCT plus DMS is the standard pairing for a one-time move of Db2 LUW into RDS or Aurora PostgreSQL. Ispirer and SQLines convert SQL PL procedures and triggers. For an ongoing sync into typed PostgreSQL tables during a long cutover, use a tool that lets you declare the target columns yourself.
Can pgloader migrate Db2 to PostgreSQL?
Not from a live Db2 database. The pgloader documentation lists SQLite, MySQL, MS SQL Server, PostgreSQL and Redshift as source databases. The only IBM input it reads is the IXF file format, so you would export each table to IXF first and load the files. Several guides suggest pgloader for this route without mentioning that.
Does AWS DMS support Db2 to PostgreSQL?
Yes for Db2 LUW, with limits. DMS lists Db2 LUW 9.7 through 11.5 as sources, and for 11.5 only Mods 0 to 8 with Fix Pack 0. Db2 12.1 is not listed. Ongoing replication needs a recoverable database (LOGARCHMETH1 or LOGARCHMETH2 on), and DMS documents that changes to DECFLOAT columns are ignored during ongoing replication.
What is the PostgreSQL equivalent of Db2 DECFLOAT?
NUMERIC. Db2 DECFLOAT is decimal floating point with 16 or 34 digits of precision. PostgreSQL has no decimal floating-point type, and its double precision keeps about 15 digits in binary, so FLOAT changes values. An unconstrained NUMERIC holds up to 131,072 digits before the point and 16,383 after, which covers the full DECFLOAT(34) range exactly.
Can AWS DMS migrate Db2 for z/OS to PostgreSQL?
Only as a one-time copy. DMS supports Db2 for z/OS version 12 as a source, but its documentation says only full load tasks are supported and change data capture is not. It also needs an IBM ODBC Connect license. Any write to the mainframe after the snapshot never reaches PostgreSQL, so a long cutover needs a different capture method.
How do I convert Db2 SQL queries to PostgreSQL?
Use a code converter for volume and review by hand. SQLines converts Db2 DDL, queries and SQL PL, Ispirer converts schema and code with a project estimate, and Microsoft offers an AI-assisted converter for Db2 LUW into Azure Database for PostgreSQL. Expect manual work on SQL PL handlers, special registers and DECFLOAT arithmetic.
What happens to Db2 timestamps with more than 6 fractional digits?
They are rounded. Db2 allows 0 to 12 fractional-second digits, default 6. PostgreSQL timestamps resolve to 1 microsecond, so the most it can keep is 6. Most columns are already at 6 and cross cleanly. Columns declared TIMESTAMP(9) or TIMESTAMP(12) lose digits, and if one sits in a unique key, two distinct values can become duplicates.
How much does a Db2 to PostgreSQL migration cost?
The tool is usually the small part. AWS SCT has no charge, DMS bills by instance hour, Ispirer publishes per-term license prices plus custom project estimates, and SQLines is licensed and quoted. Engineering time on SQL PL and testing dominates. An ongoing sync during a long cutover is a monthly subscription, which on Adapters starts at $49.
When does Db2 11.5 support end?
IBM lists 30 April 2027 as the end of base support for Db2 11.5 on Linux, UNIX and Windows (all editions except Base Edition), with extended support to 30 April 2031. Base Edition support ended 30 September 2025. Teams on 11.5 are choosing now between upgrading to 12.1, paying for extended support or leaving.

For the wider vendor landscape see the best data integration tools, and for the procedural half of a commercial-database exit, the PL/SQL conversion guide lists constructs that convert cleanly and still return different results, a pattern SQL PL shares.

Keep PostgreSQL in step with Db2 until the day you switch

Declare the columns once with NUMERIC where Db2 had DECFLOAT and BYTEA for bit data, run the backfill, then let the same mapping sync incrementally with retries and per-record logs. From $49 a month, with no per-row overage fees.

The live demo needs no card, and Starter is $49 a month.

Get started