i want to check if the username given by user is my database (Mysql workbench) or not thus i wrote the method like
{
while(rs.next())
{
if(rs.getString(1).equals(username))
{
System.out.println("already exsist");
System.out.println("Please enter another name:");
username = s.nextLine();
checkUsernameExist(rs,username);
}
}
}```
i recursively called the same method until i get a unique name from the user. My problem is when i call the method 'checkUsernameExist' the parameter rs wants to be re-initialized or move one step upward in the table. What should i do now?
& This is what i got
Enter the username:
name
already exsist
Please enter another name:
name
already exsist
Please enter another name:
name
i want to continue my loop until i get a unique name
New contributor
BHUVANESH A is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.