File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to identify the sub type of inetgrity constraint violation programmatically & vendor-neutrally?

 
Pad Ven
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Can anyone let me know if there is any way to use the SQLIntegrityConstraintViolationException (Java 5 onwards I think) to find out if "unique constraint" (or) "referential integrity constraint i.e. parent key not found" has happened? I have done this in Oracle specific manner and it works but I wish to know if there is a vendor neutral way. I am not using Spring and cannot add support for it in my current application otherwise I could try something like what is mentioned in this URL SpringSource.

I used the SQL error code returned by Oracle (1 for unique constraint, 2291 for referential integrity) because though vendor neutral, the SQL state eems to return 23000 for both types.

Expecting some help from anyone who has succeeded doing it (as that would be cleaner code that writing vendor-specific),

Regards,
TV Padmanabhan
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic