IBM DB2 to MySQL Migration

SQLines tools can help you transfer data, convert database schema (DDL), views, stored procedures, functions, triggers, queries and SQL scripts from IBM DB2 to MySQL.

SQLines can also assist you to convert COBOL stored procedures and programs to MySQL procedural SQL, Java, Python or any other language.

Databases:

  • IBM DB2 for LUW, z/OS and OS/400 11.x, 10.x, 9.x, 8.x and 7.x
  • MySQL 8.x, 6.x, 5.x

IBM DB2 to MySQL Migration Reference

Technical information on migration from IBM DB2 to MySQL:

Data Types

Converting data types:

DB2 MySQL
CHAR Fixed-length character string CHAR
DATE Date (year, month and day) DATE
INT, INTEGER 32-bit integer INT, INTEGER
SMALLINT 16-bit integer SMALLINT
TIMESTAMP Date and time DATETIME
VARCHAR Variable-length character string VARCHAR

Built-in SQL Functions

Converting functions:

DB2 MySQL
1 CURRENT DATE CURRENT_DATE Get current date CURRENT_DATE

CREATE TABLE Statement

Converting CREATE TABLE statement keywords and clauses:

DB2 MySQL
1 GENERATED AS IDENTITY Identity column AUTO_INCREMENT

Data type attributes:

DB2 MySQL
1 FOR BIT DATA Binary data encoding Removed
FOR SBCS | MIXED DATA Column data encoding (z/OS) Removed
2 CCSID ASCII | UNICODE | EBCDIC Character set Removed
CCSID num Column character set (OS/400) Removed

Implicit DEFAULT values in DB2:

DB2 MySQL
1 col_name CHAR(n) WITH DEFAULT col_name CHAR(n) DEFAULT ''
2 col_name VARCHAR(n) WITH DEFAULT col_name VARCHAR(n) DEFAULT ''
3 col_name INTEGER WITH DEFAULT col_name INTEGER DEFAULT 0
4 col_name DECIMAL(p, s) WITH DEFAULT col_name DECIMAL(p, s) DEFAULT 0
5 col_name NUMERIC(p, s) WITH DEFAULT col_name NUMERIC(p, s) DEFAULT 0
6 col_name DATE WITH DEFAULT col_name DATE DEFAULT CURRENT_DATE
7 col_name TIMESTAMP WITH DEFAULT col_name TIMESTAMP DEFAULT CURRENT_TIMESTAMP

Queries

Converting SQL SELECT statement:

DB2 MySQL
SYSIBM.SYSDUMMY1 table A single row, single column dummy table FROM clause removed

SQL Statements

Converting SQL statements:

DB2 MySQL
VALUES expression Construct a result set SELECT expression