ResultSet rs = statement.executeQuery("SELECT COUNT(DISTINCT `id`) FROM `users`");
in MySQL i have answer "5" , how to get this 5 from resultset in java? int.
Get it as an int column :
int count = -1;
if (rs.next()) {
count = rs.getInt(1);
}