MySQL
DB2 UDB
show index from tablename
select indname from syscat.indexes where
tabname=tablename
Referential integrity
Referential integrity is the constraints defined on the table and its columns, which
helps you to control the relationship of data in different tables. Essentially, it
involves primary keys, foriegn keys, and unique keys.
Primary keys and unique keys are treated similarly in MySQL and DB2 UDB
whereas MySQL currently only parses foreign keys syntax in
create table
statement, but does not use/store the information about foriegn keys except in
InnoDB tables which support checking of foreign key constraints, including
CASCADE
,
ON DELETE
, and
ON UPDATE
.
DB2 UDB provide full support for foreign keys. With the full referential integrity
functionality from DB2 UDB, your application can be released from the job of
taking care of the data integrity issue. Example 5 12 shows creation and usage
of foreign key constraint in DB2 UDB.
Example 5 12 Foriegn key constraint usage
db2> alter table itsotable1 add constraint foreign1 foreign key (id)
references itsotable2 on delete set null
We discuss more about foriegn keys creation in Section 5.5, Sample database
migration on page 117
5.4 Porting database
Now you have understand MySQL database structure/schema relative to
different types of DB2 UDB objects, such as database, tables, views, indexes and
referential integrity, in this section we give you details of the database
structure/schema conversion from existing MySQL database to DB2 UDB.
Database schema conversion can be done in various ways but most common
approaches are:
Automatic conversion using porting tools
Manual porting
Metadata transport
In general all the above approaches take existing MySQL database as input and
pass it through following functional engine:
Chapter 5. Database porting
111
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