File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Disabling constraints in DB2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Disabling constraints in DB2" Watch "Disabling constraints in DB2" New topic

Disabling constraints in DB2

M Burke
Ranch Hand

Joined: Jun 25, 2004
Posts: 397
I am making a JDBC-based application that generates sql scripts to migrate data between databases (even between db vendors). I have one for SQL2000, now I need one for DB2.

The schema has foreign key (FK) constraints, so the mass import needs to shut this off before calling sql insert statements.

In SQL2000, I use this command to disable FK constraints:

This does not work in DB2. It does not like the "NOCHECK" part. Anyone know I can fix this?
[ January 06, 2006: Message edited by: M Burke ]
Maximilian Xavier Stocker
Ranch Hand

Joined: Sep 20, 2005
Posts: 381
Don't know for DB2. Probably your best source of info would be the DB2 documentation.

One thing that would be a more generic solution would be to drop the key and add it back upon completion.
I agree. Here's the link:
subject: Disabling constraints in DB2
It's not a secret anymore!