Tenho uma duvida estou fazendo um trabalho da faculdade mas não estou conseguindo inserir dados mysql no netbeans está dando um error e não sei o que fazer.
Meu código está assim:
public boolean incluir() {
try {
if (!estaConectado()) {
conecta();
}
stmt = objCon.createStatement();
sql = "INSERT INTO clientes ("
+ "codigo,"
+ "nome,"
+ "cpf,"
+ "telefone,"
+ "endereco,"
+ "cidade,"
+ "status "
+ ") VALUES ("
+ this.getCodigo() + ", '"
+ this.getNome() + "', '"
+ this.getCPF() + "', "
+ this.getTelefone() + ", '"
+ this.getEndereco() + "', "
+ this.getCidade() + ", "
+ this.getStatus()
+ ")";
stmt.executeUpdate(sql);
stmt.close();
System.out.print(this.sql);
return true;
} catch (SQLException objErro) {
JOptionPane.showMessageDialog(null,
"Não foi possível executar a Query /n"
+ objErro.getMessage() + "/n"
+ sql
);
return false;
}
}