*In the Login page user give his username and password and logging in to the Home Page.(checking user details with MySQL database and validating data).
*In the Home page I want to show Logged As : [Logged user name] . I tried below method but not successful.
 public void showUsername() throws SQLException{
    String sql1 = "SELECT username FROM logininfo WHERE username= '"+uname+"'" ;
    stmt = conn.createStatement();
    rs = stmt.executeQuery(sql1);
    while(rs.next()){
        String name=rs.getString("username");
        loggedUname_lbl.setText("You are Logged in as : "+name);
   }
*uname is the text given by the user as the username in the Login page.
 
     
     
    