title: What is the proper way to catch and handle ORA-00001 SQLException with JDBC?
body: <p>I'm creating a simple form that stores entered data in an extremely simple Oracle database table via a Java Servlet using JDBC.  That table is using the email address as a primary key.  If a user submits a form multiple times with the same email address, the <code>execute</code> function fails and throws a SQLException.  The exception's string is the following:</p>
  
  <pre><code>java.sql.SQLException: ORA-00001: unique constraint (...removed...) violated
  </code></pre>
  
  <p>In this scenario, I would like to catch this exception and deal with it by telling the user that the form cannot be submitted multiple times with the same email address.  What is the proper way to handle ORA-00001 separately and differently from any of the other SQLExceptions that can be thrown by <code>execute</code>?  A string compare could obviously work here, but that seems like a poor solution.</p>