I am trying to make a to-do list using NetBeans-8.0.2 and JavaFX (FXMLApplication) that stores memory into MySQL database.
I know that, SQL query takes inverted comma -> ( ' ) and double quotation -> ( " ) as the same to understand a string.
Now, what i am trying is, (today is my sister's birthday) i am trying to add a task in my list that says: It's Rahi's birthday!
but, due to sql query, it is failing.
it's because inside the code, input's inverted comma is making a complexity in the sql query as a whole.
 @FXML
private void handleAddTaskAction(ActionEvent event) {
    String date = addTaskDatePicker.getValue().toString();
    System.out.println(date);
    String hour = hourComboBox.getValue() + "";
    String minute = minuteComboBox.getValue() + "";
    String where = whereField.getText();
    String header = headerField.getText();
    String description = descriptionArea.getText();
    if(hour.length()==0)
        hour= "12 AM";
    if(minute.length()==0)
        minute= "00";
    if(header.length()==0)
        header= "(No header available)";
    if(description.length()==0)
        description= "(No description available)";
    if(header.length()==0 && description.length()==0){
        header= "(Empty task)";
        description= "(Empty description)";
    }
    String query = "insert into task values('" + date + "','" + hour + " " + minute + " minutes', '"
            + header + "', '" + description + "', 'at " + where + "');";
    if (date.length() >= 1) {
        try {
            statement.execute(query);
        } catch (SQLException ex) {
            //Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex);
            Alert alert = new Alert(Alert.AlertType.ERROR);
            alert.setHeaderText("Error occured!");
            alert.showAndWait();
        }
    } else {
        Alert alert = new Alert(Alert.AlertType.WARNING);
        alert.setHeaderText("You must select a date.");
        alert.showAndWait();
    }
}
i want to store the message as it is typed. Any solutions ?
my database table description and The GUI are attached as picture. Ask me if you need anything else. Thank you.
Picture of: GUI and Picture of: Table description
 
    