'Question regarding my use of ResultSet pointer and JDBC for console banking project

I am working to create for the purpose of learning OOP, Java and JDBC a small Console banking application. I have tinkered around and created a login method in my Menu object -- it creates a prepared statement and uses logical tests on the returned ResultSet object to simulate a "Login" environment.

For the purpose of transparency, I start soon at a train to hire consultancy and this is one of their example projects. I am working through myself with the hopes I might be able to learn the language and the environment, and practice design principles reasonable to someone of my experience level (around 4 weeks of Java, but years of Hacking around in Perl, C, web languages. Played with vb6 as a boy)

My question: is the code I am providing to perform the test wonky... terrible, or even putting me at a state of a QC evaluator to break my software with bad logic breakind inputs? Thank you all for looking

String loginAttemptSQL = "SELECT * FROM USERS WHERE login = ? AND password = ?;";
        String userID, userPW;
        Scanner Scan = new Scanner(System.in);
        System.out.println("Please Enter your User ID!");
        userID = Scan.nextLine();
        System.out.println("Please Enter your Password!");
        userPW = Scan.nextLine();
// may be passing this array for ease of access to a constructor at some point, will comment out if i don't need it     
String idAndPW[] = {userID, userPW};
//create JDBC Objects and prepare statements. Variables are assigned via UserInput
            Connection Conn = DriverManager.getConnection(SQL_URL, SQL_USERNAME, SQL_PASSWORD);
            PreparedStatement Stmt = Conn.prepareStatement(loginAttemptSQL);
            Stmt.setString(1, userID);
            Stmt.setString(2, userPW);
            //declaraton of metadata for logical operator use
            ResultSet rs = Stmt.executeQuery();
            ResultSetMetaData rsmd = rs.getMetaData();
            int columnumber = rsmd.getColumnCount();
            //my main question here -- is this next logic bad practice? Will it break? Am i Mismanaging this pointer and in danger of breaking anything? 
            
            if (rs.next() == true) {
                for(int i=1; i <= columnumber; i++) {
             // this will be replaced with the creation of a new 'Main Menu' object that a user sees post login. It's not visible here, and I'd be happy to provide it but I am hoping to implement a command pattern for the bank "operations" and transactions that I log via a decorator to Prepared Statements and/or an external logging tool -- seeing as I am gleaming the project requirements from the repos of other employees I haven't been able to "ask" the QCs if I can use external logger APIs or just Java.Util.Logging
            System.out.print(rs.getString(i) + " " + rsmd.getColumnName(i));
                }
                }
            else {System.out.println("Login incorrect! Please try again!");
            login();}

I would be happy to hear feedback and already appreciate your time!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source