title: More elegant way to insert empty java.sql.Date in Sql DB
body: <p>Hi i'm trying to insert a Date via Servlet in SQL database. If the post submitted field birthday is emtpy then it should insert 0000-00-00</p>
  
  <p>but this is a bit complicated.</p>
  
  <p>i did it this way and it works:</p>
  
  <pre><code>if (birthdate == null) {
              ps_employee.setInt(4, 0); //ps_employee is my PreparedStatement
          } else {
              ps_employee.setDate(4, birthdate);
          }
  </code></pre>
  
  <p>birthday is null if the post field has no value. otherwise birthday contains a valid java.sql.date object.</p>
  
  <p>The code above works but it shows a warning in sql : "data for birthday truncated"....</p>
  
  <p>Is there a better way to insert a 0000-00-00 Date ???</p>
  
  <p>thanks for your help..</p>