Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try
- {
- Class.forName("org.postgresql.Driver");
- Connection con=DriverManager.getConnection("JDBC:postgresql://localhost/aula_neri","admin","123456");
- Statement st = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
- ResultSet.CONCUR_READ_ONLY);
- ResultSet rs = st.executeQuery("select * from login where log_usuario = '"+
- request.getParameter("usuario")+"' and log_senha = '"+
- request.getParameter("senha")+"'");
- if(rs.next())
- response.sendRedirect("index.jsp");
- else
- out.println("Negado!");
- }
- catch(ClassNotFoundException erroClass)
- {
- out.println("Classe Driver JDBC não localicado:"+erroClass);
- }
- catch(SQLException erroSql)
- {
- out.print("Erro de conexão com ao banco de dados"+erroSql);
- }
- //David
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement