title: Add date from JXDatePicker into SQL Database in Netbeans
body: <p>I would like to add a date value from JXDatePicker into my SQL database, however I'm getting this error when running it: </p>
  
  <p>java.sql.sqldataexception: the syntax of the string representation of a datetime value is incorrect</p>
  
  <p>This is my code:</p>
  
  <pre><code>try {
      String url = "jdbc:derby://localhost:1527/Members";
      String username = "admin1";
      String password = "admin1";
  
      Connection con = DriverManager.getConnection(url, username, password);
      Statement stmt = con.createStatement();
  
      String query = "INSERT INTO BOOKING(MEMBERID, NAME, CONTACT, "
              + "EMAILADDRESS, RESERVATIONDATE, RESERVATIONTIME) "
              + "VALUES('"+txtMemberID.getText()+"', '"+txtName.getText()+"', "
              + "'"+txtContact.getText()+"', '"+txtEmail.getText()+"', "
              + "'"+comboDate.getDate()+"', '"+comboTime.getSelectedItem()+"')";
  
      stmt.execute(query);
  
      JOptionPane.showMessageDialog(null, "Booking created");
  
      txtMemberID.setText(null);
      txtName.setText(null);
      txtContact.setText(null);
      txtEmail.setText(null);
      comboDate.setDate(null);
      comboTime.setSelectedItem("00");
  
      }
      catch(SQLException ex) {
          JOptionPane.showMessageDialog(null, ex.toString());
      }
  </code></pre>
  
  <p>The datatype specified for the Date attribute in my database is Date.</p>
  
  <p>Thank you.</p>