Answer the question
In order to leave comments, you need to log in
How to iterate through the Result set correctly?
This code example only returns the first column. Need to get password and email ..
String queryDataBase = "SELECT nickname,password,email FROM users WHERE nickname = ? AND password = ? AND email = ?";
PreparedStatement preparedStatement = connection.prepareStatement(queryDataBase);
preparedStatement.setString(1, name);
preparedStatement.setString(2, password);
preparedStatement.setString(3, email);
ResultSet resultSetQuery = preparedStatement.executeQuery();
if (resultSetQuery != null){
byte i = 1;
while(resultSetQuery.next()) {
System.out.println(resultSetQuery.getString(i));
i++;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question