would anyone please take a quick look? this always return false for some reason... the database connection is fine and the query is fine... it actually returned the right password from the database. please see below
public boolean passCheck(String login, String pass)
{
String realPass="";
try
{
String query ="SELECT password FROM admin_user where login_name='"+login+"'";
resultSet = statement.executeQuery(query);
while ( resultSet.next() )
{
realPass = resultSet.getString("password");
System.out.println(realPass);
}
}
catch(SQLException sqlex)
{
sqlex.printStackTrace();
}
// the returned password is correct
System.out.println("from db pass is "+realPass);
// this matches the password from above
System.out.println("entered pass is "+pass);
if(pass == realPass)
{
return true;
}
else
{
return false;
}
}
please point out why this function always return "false" ... thanks very much