Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void reggy(ActionEvent event) {
- try {
- String username_text = username.getText().trim();
- String password_text = password.getText().trim();
- Connection conn = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/store","root","password");
- Statement st = (Statement) conn.createStatement();
- String sql = "select username, password from users where username ='"+username_text+"' and password ='"+password_text+"'";
- ResultSet rs;
- rs = st.executeQuery(sql);
- int count = 0;
- while(rs.next()) {
- count = count +1;
- }
- if(count == 1){
- AnchorPane pane = FXMLLoader.load(getClass().getResource("second.fxml"));
- rootpane.getChildren().setAll(pane);
- System.out.println("User Found, Logged in");
- }
Add Comment
Please, Sign In to add comment