问题
Is there a setting in derby, for example an sql query ala "SET DATABASE REFERENTIAL INTEGRITY FALSE" where i can turn on and off referential integrity?
回答1:
According to this post on the mailing list (from 2006) it is not possible:
http://www.mail-archive.com/derby-user@db.apache.org/msg05345.html
I couldn't find anything in the manual either.
And the list of jdbc parameters has nothing, too.
回答2:
If you have a constraint that you don't wish to enforce, you can use DROP CONSTRAINT to drop it.
I frequently drop a constraint for a period of time while I am re-structuring my database, then re-add the constraint subsequently when I have the new data arranged as I want it.
来源:https://stackoverflow.com/questions/9159287/turn-off-referential-integrity-in-derby-is-it-possible