I have some doubts about this one, I have gone through others topics but I still can't get the code workig properly.

My intent is to insert dates into my DB using JDBC, I'm using a jTextField (or a JformattedField, trying both ways) and all I get is an error from the database. Its Because I'm sending text instead date, so, how can I send dates ?

EDIT1: I'm trying to send date of birth.

Already made some tries, that's why I have:

```
SimpleDateFormat formatter  = new SimpleDateFormat ("dd/MM/yyyy"); 
    java.sql.Date data = new java.sql.Date(formatter.parse().getTime());

```

code:

```
try {   
        conecta.conn.setAutoCommit(false);
        PreparedStatement pst = conecta.conn.prepareStatement("INSERT INTO cad_pessoa(cad_cpf,cad_nome, cad_idade, cad_apelido, cad_data) values (?,?,?,?,?)");

        pst.setString(1, jFormattedTextFieldCPF.getText()); //pega o texto insirido e armazena no banco de dados
        pst.setString(2, jTextFieldNOME.getText()); //pega o texto insirido e armazena no banco de dados
        pst.setString(3, jTextFieldIDADE.getText()); //pega o texto insirido e armazena no banco de dados
        pst.setString(4, jTextFieldApelido.getText());//pega o texto insirido e armazena no banco de dados
        SimpleDateFormat formatter  = new SimpleDateFormat ("dd/MM/yyyy");
        java.sql.Date data = new java.sql.Date(formatter.parse().getTime());
        pst.setDate(5, formatter.parse(jFormattedTextFieldDATA.getText())); //pega o texto insirido e armazena no banco de dados
        pst.executeUpdate(); //executa o SQL

        conecta.conn.commit();

        jFormattedTextFieldCPF.setText(""); //deixa o campo vazio
        jTextFieldNOME.setText(""); //deixa o campo vazio
        jTextFieldIDADE.setText(""); //deixa o campo vazio
        jFormattedTextFieldDATA.setText("");
        jTextFieldApelido.setText(""); //deixa o campo vazio

        jFormattedTextFieldCPF.setEnabled(false);
        jTextFieldNOME.setEnabled(false);
        jTextFieldIDADE.setEnabled(false);
        jFormattedTextFieldDATA.setEnabled(false);
        jTextFieldApelido.setEnabled(false);
        JOptionPane.showMessageDialog(null, "Salvo!");

    } catch (SQLException ex) {
        JOptionPane.showMessageDialog(rootPane, "Erro!\n" +ex);

    }

```