/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package br.ifirst.autosystem.daos;
import br.ifirst.autosystem.connections.Conexao;
import br.ifirst.autosystem.mb.CadastroAlunoMB;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
/**
*
* @author Uaslei
*/
public class CadastraAlunoDao {
private static class getCon {
private static void close() {
throw new UnsupportedOperationException("Not yet implemented");
}
private static PreparedStatement prepareStatement(String sql) {
throw new UnsupportedOperationException("Not yet implemented");
}
public getCon() {
}
}
public void inserir(String codigoAluno) {
throw new UnsupportedOperationException("Not yet implemented");
}
private static class ConectaraoBanco {
// Connection c = new Conexao();
public ConectaraoBanco() {
}
}
private Connection getcon;
public CadastraAlunoDao() throws SQLException{
this.getcon = Conexao.getConnection();
}
public void Salvar() throws SQLException {
String sql = "insert into aluno (cd_aluno,nm_aluno,status,endereco,cidade,bairro,uf,cep, data_nasc,idade, sexo, cpf,rg, nacionalidade,"
+ "natural,uf,nm_mae,nm_pai, telefone,telefone2,telefone3) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
Connection getCon = new Conexao().getcon();
PreparedStatement stmt = getCon.prepareStatement(sql);
stmt.setString(getCodigoAluno());
stmt.setString(getNome());
stmt.setString(3, mb.getStatus());
stmt.setString(4, mb.getEndereco());
stmt.setString(5, mb.getCidade());
stmt.setString(6, mb.getBairro());
stmt.setString(7, mb.getUf());
stmt.setString(8, mb.getCep());
stmt.setString(9, mb.getDataNasc());
stmt.setString(10, mb.getIdade());
stmt.setString(11, mb.getSexo());
stmt.setString(12, mb.getCpf());
stmt.setString(13, mb.getRg());
stmt.setString(14, mb.getNacionalidade());
stmt.setString(15, mb.getNatural());
stmt.setString(16, mb.getUf());
stmt.setString(17, mb.getNomeMae());
stmt.setString(18, mb.getNomePai());
stmt.setString(19, mb.getTelefone());
stmt.setString(20, mb.getTelefone1());
stmt.setString(21, mb.getTelefone2());
stmt.execute();
stmt.close();
getCon.close();
}
}
O que esta errado no meu código fonte, a conexão com o banco eu to tratando ela fora do dao.
me ajudem por favor.