title: How to insert java.util.Date in database?
body: <p>I want to insert a date in the database, but it does not work any error message that appears. When I look at my table in Oracle DB I can not find my data that I inserted.</p>
  
  <pre><code>java.util.Date daterecep;
  // getter and setter
  public void setdaterecep( java.util.Date daterecep) {
           this.daterecep=daterecep;
  } 
  public  java.util.Date getdaterecep() {
         return  daterecep;
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>    nt val=0;
      try {
          val = st.executeUpdate("insert into tabdate (date) values('"+daterecep+"')" );
      } catch (SQLException ex) {
           Logger.getLogger(Insertdate.class.getName()).log(Level.SEVERE, null, ex);
      }
  
      System.out.println(val);
      return resultat;
  }
  </code></pre>
  
  <p>I used PreparedStatement but it did not worked I just tried to execute the Java code </p>
  
  <pre><code>val = st.executeUpdate("insert into tabdate(date) values('12/12/2004')");
  </code></pre>
  
  <p>and add</p>
  
  <pre><code>public static void main (String args[]) throws SQLException {
  
      Insertdate B= new Insertdate();
      B.connexionBD();
      B.insert();//function for the insertion
  }
  </code></pre>
  
  <p>and it works.</p>