Advertisement
Guest User

Untitled

a guest
Dec 29th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. import java.sql.*;
  2.  
  3. public class ConnectBD {
  4. private Connection con;
  5. private Statement st;
  6. private ResultSet rs;
  7.  
  8.  
  9. public ConnectBD() {
  10. try {
  11. Class.forName("com.mysql.jdbc.Driver");
  12. con = DriverManager.getConnection("jdbc:mysql://localhost:3306/projectopdm", "root", "");
  13. st = con.createStatement();
  14. } catch (Exception e) {
  15. System.out.println("Error" + e);
  16. }
  17. }
  18.  
  19. public boolean testPW(String email,String passe){
  20. String query="Select password from utilizador where IDUtilizador='"+email+"'";
  21. try{
  22. rs=st.executeQuery(query);
  23. if(rs.next()){
  24. String passeword=rs.getString(1);
  25. return passe.equals(passeword);
  26. }
  27. }catch(Exception e){
  28. System.out.println("ERROR: "+e);
  29. }
  30. return false;
  31. }
  32.  
  33. public boolean inserirUser(String email,String nome,String passe,String dataNascimento){
  34. //completar
  35. return true;
  36. }
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement