Answer the question
In order to leave comments, you need to log in
mysql and java registration?
I wrote the code:
private Boolean checkLogin() throws SQLException {
String query="SELECT COUNT(*) FROM testtable WHERE LOGIN=?";
PreparedStatement preparedStatement = DB.connection.prepareStatement(query);
preparedStatement.setString(1,clientSend.getLogin());
preparedStatement.execute();
}
Answer the question
In order to leave comments, you need to log in
private Boolean checkLogin() throws SQLException {
String query="SELECT COUNT(*) FROM testtable WHERE LOGIN= :login";
PreparedStatement preparedStatement = DB.connection.prepareStatement(query);
preparedStatement.setString("login", clientSend.getLogin());
ResultSet resultSet = preparedStatement.executeQuery();
if (!resultSet.next()) throw new RuntimeException();
int count = resultSet.getInt(1);
return count == 1;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question