title: How do we confirm SQL Data Manipulation Language (DML) statement is success?
body: <p>I have the following code to confirm the SQL result</p>
  
  <pre><code>int i = stmt.executeUpdate();
  if (i &gt; 0) {
      System.out.println("success");
  } else {
      System.out.println("stuck somewhere");
  }   
  </code></pre>
  
  <p>JavaDoc says "executeUpdate returns"</p>
  
  <blockquote>
    <p>either (1) the row count for SQL Data Manipulation Language (DML) statementsor (2) 0 for SQL statements that return nothing</p>
  </blockquote>
  
  <p>Now, we have done partitioning using TRIGGER and my INSERT query returns 0 for all Insert queries and records are inserted into appropriate partitions. </p>
  
  <p>So, now I have to remove the check for success and rely on SQLEXCEPTION for errors.</p>
  
  <p>Can I ignore the following check and trust the records are Inserted/Updated in DB.</p>
  
  <pre><code>if (i &gt; 0) {
      System.out.println("success");
  } else {
      System.out.println("stuck somewhere");
  }  
  </code></pre>