SQL authorization ID = ITSOSJ
Local database alias = ITSODB2
bash>db2 tf "itsodb2.db2.create.2004.02.03.09.41"
DB20000I The SQL command completed successfully.
DB20000I The SQL command completed successfully.
DB20000I The SQL command completed successfully.
DB20000I The SQL command completed successfully.
Incase you are migrating InnoDB tables having foreign keys you need to migrate
them manually as MTK does not support migration of foreign keys. So after
running MTK in test mode you need to change the create table statement in
output.mysql.create.
and remove
CONSTRAINT constraint name .
You will create the table without the foreign key. After migrating your data you
then create a foreign key on this table.
Example 5 22 shows two MySQL InnoDB tables with the referential integrity
defined.
Example 5 22 MySQL InnoDB using foriegn key
mysql> create table innoParent(id int not null,name char(20), primary key(id))
type=INNODB;
mysql> create table innoChild(cid int not null,name char(20), pid int not null,
primary key(cid),index(pid),foreign key(pid)
references innoParent(id)) type=INNODB;
Example 5 23 is the conversion to DB2.
Example 5 23 DB2 conversion of innoDB foreign key
db2>create table innochild
(cid int not null default 0, name char(20) default null,
pid int not null default 0, primary key(cid))
db2>create table innoparent
(id int not null default 0, name char(20) default null,
primary key(id));
db2>alter table innochild add constraint foreign1 foreign key (pid)
references innoParent
Note:
If you are adding foriegn key constaints before migrating data, make
sure that you load the parent table data before the child table.
Chapter 5. Database porting
125
footer
Our partners:
PHP: Hypertext Preprocessor Cheap Web Hosting
JSP Web Hosting
Ontario Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Java Hosting
Cheapest Hosting
Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved