Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Intercept Foreign Keys violation via JDBC

mc1976Jul 30 2009 — edited Nov 20 2014
Hi to all,

I'm trying to face the problem to ensure data integrity in my applications, expecially to ensure that in a DB table, in a column which refers to some entity's code (e.g, a customer code), there is no way to insert an illegal value. Of course, by defining Foreign Key Constraints, i'm able to achive this goal in a simply and reliable way.
The problem is I can't figure out how to get which was the illegal value user tried to insert. Until now, if I have to populate a table with n different codes, defined in n different
tables, I'm forced to verify via select which codes are legal and which not, and produce an error message. If the codes to be check are quite a number, this approach is really inefficient, so i'm trying another way.

Any suggestion ?
Thank you.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 27 2009
Added on Jul 30 2009
9 comments
69 views