Oracle数据库验证用户密码

时间:2015-10-09 16:40:06

标签: sql oracle plsql

我希望用程序验证数据库用户。我需要检查用户给出的密码是否是该用户的密码,然后返回一个布尔值。我知道我可以使用带有替换选项的更改用户命令,但这实际上会改变用户的密码,该密码将作为密码更改记录在后端。我需要避免这种情况,只需验证密码是否正确。有没有办法做到这一点?

1 个答案:

答案 0 :(得分:0)

pelas看看How to validate my password with the value in the oracle database and also what is the difference between return 0 and return 1 in java

                               `
    public int present(){

     // make query for Oracle data base
         String yourQry = "select * from yourtable where password = '"+pass+"' and username='"+username+"'" . 
      //Use this query when you are fetching data from user.
      Resultset rs;     // fetch your data in resultset
           if(rs.next()){
                 // if data got fetched 
                 return 1;
                 // 1 means true
            }
           else{
                    return 0; // 0 means false (No datafound) 
           }

          } `