Olá pessoal!!..
estou com um problemão e nao consigo resolver de jeito nenhum!!! esse bendito nullPointerException!!! ai vai meu codigo…
aqui é o Banco:
public boolean abreConnection() {
boolean result = true;
try {
Class.forName("org.gjt.mm.mysql.Driver");
db = DriverManager.getConnection("jdbc:mysql://127.0.0.1/vidros", "root", "");
JOptionPane.showMessageDialog(null, "Conectou");
} catch (SQLException e) {
JOptionPane.showMessageDialog(null, "Não conectou " + e);
} catch (ClassNotFoundException e) {
JOptionPane.showMessageDialog(null, "driver nao encontrado " + e);
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "base de dados nao encontrado " + e);
}
return result;
}
aqui é o codigo que ta me dando dor de cabeça (hehehhehehehe):
try {
con = new Conexao();
con.abreConnection();
String sqlInsert = ("INSERT INTO cad_clientes (nome, email, ddd_Fixo, tel_Fixo," +
"ddd_Cel, Cel, endereco, n, complemento, CEP, Cidade, Estado" +
"RG, CPF, Nacimento) values('" + text_Nome.getText() + "','" + text_Email.getText() + "','" + text_DDDFixo.getText() + "','" + text_TelFixo.getText() + "','" + text_DDDCel.getText() + "','" + text_Celular.getText() +
"','" + text_Endereco.getText() + "','" + text_N.getText() + "','" + text_Complemento.getText() + "','" + text_CEP.getText() +
"','" + text_Cidade.getText() + "','" + text_Estado.getText() + "','" + text_RG.getText() + "','" + text_CPF.getText() + "','" + text_Nascimento.getText() + "')");
con.updateSQL(sqlInsert);
JOptionPane.showMessageDialog(null, "Cadastro Realizado com Sucesso!", null, JOptionPane.INFORMATION_MESSAGE);
}/*catch(SQLException e){
JOptionPane.showMessageDialog(null,"Erro ao tentar gravar o registro! "+e);
}*/ catch (Exception e) {
throw new NullPointerException(""+e);
}
se alguem puder me ajudar eu vou ficar muito agradecido!!!