Boa noite galera,
Estou com um problema do qual não consigo resolver , quando tenta rodar minha aplicação web o eclipse volta com o seguinte erro " No suitable driver found for jdbc ". Já atualizei o JRE , o JDBC está na classpath do projeto e já verifiquei a versão do JDBC e do banco de dados porém erro persiste. Alguém tem alguma dica que posso ajudar?
Segue código
CLASSE CONEXÃO BD
public class ConnectoryFactory {
public Connection getConnection() {
try {
//Class.forName("com.mysql.jdbc.Driver");
return DriverManager.getConnection("jdbc:mysql://localhost/exercicio1?useTimezone=true&serverTimezone=UTC","alessandra",
"Skyl1n3G7R");
}catch(Exception e) {
throw new RuntimeException(e);
}
}
}
Classe DAO cadastro
public void cadastro(Aluno aluno) throws SQLException {
Connection con = new ConnectoryFactory().getConnection();
try {
PreparedStatement ps = con.prepareStatement("insert into aluno"+" (nome,ra)"+
"values (?,?)");
ps.setString(1, aluno.getNome());
ps.setString(2, aluno.getRa());
ps.execute();
ps.close();
}catch(Exception e) {
throw new RuntimeException(e);
}
}
SERVLET
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
AlunoDAO aludao = new AlunoDAO();
Aluno aluno = new Aluno() ;
String nome = request.getParameter("nome");
String ra = request.getParameter("ra");
aluno.setNome(nome);
aluno.setRa(ra);
aludao.cadastro(aluno);
//request.setAttribute("cada", aluno);
RequestDispatcher rd = request.getRequestDispatcher("/cadastroRealizado.html");
rd.forward(request, response);
}catch(Exception e) {
System.out.println(e);
}
}