Withdata Software

Copy DB2 query results to PostgreSQL table

Want to transfer data from DB2 query results to PostgreSQL table?

Try Withdata DBCopier, a DB2 to PostgreSQL converter for Windows, Mac, and Linux, Copy DB2 query to PostgreSQL, Easy and Fast.

Download Withdata DBCopier
Windows 64 bit
Windows 32 bit
Linux .deb (For Debian, Ubuntu) 64 bit
Linux .rpm (For Red Hat, Fedora, SUSE) 64 bit
MacOS 64 bit

Transfer data from DB2 query To PostgreSQL table

Login to DB2 and PostgreSQL -> Enter source DB2 query -> Set target PostgreSQL table -> Copy DB2 query data to PostgreSQL table

Choose source DB2 database and logon.

Choose target PostgreSQL database and logon.

Click “Convert From Query” at task dialog.

then show the wizard.

1. Set a DB2 query.

2. Select a destination PostgreSQL table and config fields.

3. Preview data.

4. Transfer data from DB2 query result to PostgreSQL table.


More about DB2 to PostgreSQL converter

See also:

DB2 → PostgreSQL reference

Type mapping

Value kindin DB2in PostgreSQL
IntINTEGERinteger
BigintBIGINTbigint
DecimalDECIMAL(p,s)numeric(p,s)
FloatDOUBLEdouble precision
TextVARCHAR(n)varchar(n)
Long textCLOBtext
DateDATEdate
DatetimeTIMESTAMPtimestamp
BinaryBLOBbytea
BooleanSMALLINTboolean
JSONCLOBjsonb

Dialect differences

Both DB2 and PostgreSQL are database servers, so the differences below are dialect-level: the same concept is spelled differently on each side.

Propertyin DB2in PostgreSQL
port500005432
row limitFETCH FIRST n ROWSLIMIT n
datesDATE, TIME, TIMESTAMPtimestamp, timestamptz, date, time
long textCLOBTEXT
binaryBLOBBYTEA

Command line

SideCommand
DB2EXPORT TO out.csv OF DEL
PostgreSQLpg_dump or COPY ... TO
PostgreSQL (load)COPY ... FROM
DB2 (load)db2 IMPORT FROM file OF DEL

Convert your data online, free

Free in-browser converters for CSV, Excel, JSON, XML and SQL: Withdata Online Data Conversion. Large files, batch conversion or scheduling? See the offline desktop apps, or browse all data conversion tools.