title: How to determine a database constraint violation in java?
body: <p>I am relying on the database to tell me if there is a uniqueness violation so I would like to know when the exception I am getting is some sort of constraint violation.  It looks like this is exactly what I need: <code>java.sql.SQLNonTransientException</code></p>
  
  <p>But it is new to 1.6 and I'm not confident my database drivers are new enough. I use many DBMSs and have many clients, so relying on the driver to be up-to-date is difficult.</p>
  
  <p>Is there a generic way to check for this pre-java 1.6 other than searching the exception message for "constraint"?</p>