Pretty much writing a launcher for a game and I need to take text from the Username text box, and a password textbox and then fetch the data from mysql server. This is what I have so far. Any help or examples on how to do this?
public class SQLCheck {
    public java.sql.Connection con;
    public void connect(){
        String host = "sttfz";
        String username = "roiot";
        String pass = "yourmother";
        String db = "users";
        try{
            Class.forName("com.mysql.jdbc.Driver");
            Strin开发者_如何学Gog connectionUrl = "jdbc:mysql://"+host+"/"+db+"?";
            con = (java.sql.Connection) DriverManager.getConnection(connectionUrl,username,pass);
            System.out.println("Server: Connected to MYSQL");
        } catch(SQLException e){
            System.out.println("Server: SQL EXECEPTION: " + e.toString());
        } catch (ClassNotFoundException cE){
            System.out.println("Server: Class not found: " + cE.toString());
        }
    }
    boolean checkLogin(String userName, String password) throws SQLException{
        boolean correct = false;
        Statement s = con.createStatement();
        s.executeQuery("SELECT Username, Password, Banned, Activated FROM Users");
        ResultSet rs = s.getResultSet();
        return correct;
    }
}
Nearly there. Check out the official JDBC Tutorial and you'll realize what to do next in no time (hint: fetch the values from the resultset)
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论