java 即使在删除唯一约束后 DuplicateKeyException

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12074885/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 07:30:00  来源:igfitidea点击:

DuplicateKeyException even after removing unique constraints

javadb2constraintsunique

提问by MicNeo

I'm working on db2. I got one table, which contains some data:

我在 db2 上工作。我有一张表,其中包含一些数据:

Data | Value | Lang

To Data column of this table, was added unique constraint. However, now application CAN contain many rows for the same date. So, I removed constraint, but, after reorganization of table, restart of server it still throws exceptions when I want to add more than one row with the same Data.

对该表的数据列添加了唯一约束。但是,现在应用程序可以包含同一日期的多行。所以,我删除了约束,但是,在重组表后,重新启动服务器,当我想添加多个具有相同数据的行时,它仍然会抛出异常。

Unfortunately I didn't create this table at first place, and I can't remove data from it :/

不幸的是,我一开始没有创建这个表,我无法从中删除数据:/

Anyone has any idea what's going on?

任何人都知道发生了什么?

Thanks for you time!

谢谢你的时间!

采纳答案by MicNeo

Okay, it looks like there was index on this column also.

好的,看起来这个列上也有索引。

To check indexes:

检查索引:

select * from SYSIBM.SYSINDEXES where TBNAME= 'TABLE_NAME';

To drop index:

删除索引:

drop index INDEX_NAME;

Now it works! :) Quite easy.

现在它起作用了!:) 很容易。