oracle 错误:java.sql.SQLException:ORA-01017:用户名/密码无效;登录被拒绝

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16457361/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 01:39:13  来源:igfitidea点击:

error : java.sql.SQLException: ORA-01017: invalid username/password; logon denied

oracleora-01017

提问by user2340915

I entered 10 questions in database, with their answers. I started project, I logged in candidate id. After that I gave admit id, it was accepted. After that I tried to open this page(this page is meant to open the test page, which will open questions), and I got error message - java.sql.SQLException: ORA-01017: invalid username/password; logon denied As far I know, there is no error in coding of project. So I had not posted the coding. Error is somewhere in database connectivity. (I had seen other topics with this error, but not found help).

我在数据库中输入了 10 个问题,以及他们的答案。我开始了项目,我登录了候选人 ID。之后我给了录取 id,它被接受了。之后我试图打开这个页面(这个页面是为了打开测试页面,这将打开问题),我收到错误消息 - java.sql.SQLException: ORA-01017: invalid username/password; 登录被拒绝 据我所知,项目编码没有错误。所以我没有发布编码。错误是数据库连接中的某个地方。(我曾看过其他有关此错误的主题,但未找到帮助)。

 {   if(minutes==0 && seconds==0)
    {
       alert('Oops ! ! Time up '+
            'Test Submitted Successfully');
        VerbForm.submit();
    }
seconds=60;
minutes--;
window.setTimeout("timer()", 1000 );   

}
}

}
}



" 名称="格式"> Time Remaining:剩余时间:


" style="border:0px 纯白;背景:#F0EFE2">:" style="border:0px 纯白色;背景:#F0EFE2"> timer();
        </div>



  <div id="site_content">

  <div id="content">

    <%
    try{
    int i=1;
    Random rand =new Random();
    int newrand=rand.nextInt(9);
    session.setAttribute("verbrandom",String.valueOf(newrand));
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","java","12345");
     String admitid=session.getAttribute("admitid").toString();
    int aid=Integer.parseInt(admitid); 
    PreparedStatement ps1=con.prepareStatement("select verbkey from result where admitid=?");
    ps1.setInt(1,aid);
    ResultSet rs1=ps1.executeQuery();
    rs1.next();
    if(rs1.getInt("verbkey")==1)
                   {
                    response.sendRedirect("AlreadyExam.jsp");
                   }
           else
           {
    PreparedStatement ps=con.prepareStatement("select * from verbal where qid>? order by qid");
    ps.setInt(1,newrand);
    ResultSet rs=ps.executeQuery();
        while(rs.next() && i<=10)
        {
    %>

    <form action="VerbalResult.jsp" align="left" name="VerbForm">



        <P><b><%=i%>. <%=rs.getString("question")%></b><BR><BR>

" value="<%=rs.getString("option1")%>">  A.  <%=rs.getString("option1")%>  " value="<%=rs.getString("option2")%>">  B.  <%=rs.getString("option2")%>

" value="<%=rs.getString("option3")%>">  C.  <%=rs.getString("option3")%>  " value="<%=rs.getString("option4")%>">  C.  <%=rs.getString("option4")%>

" value="<%=rs.getString("option1")%>"> A. <%=rs.getString("option1")%> " value="<%=rs.getString("option2")% >"> B. <%=rs.getString("option2")%>

" value="<%=rs.getString("option3")%>"> C. <%=rs.getString("option3") %> " value="<%=rs.getString("option4")%>"> C. <%=rs.getString("option4")%>

             <%
                i++;
                     } rs.close();
                        ps.close();        
                        } 
                     con.close();
                     rs1.close();
                     ps1.close();


    }
    catch(NullPointerException e)
                          {
        response.sendRedirect("CandidateLogin.jsp");
    }
            %>

<p><input style="padding-top: 25px; font: 100% arial; border: 1px solid; width: 170px; margin: 0 0 0 212px; height: 33px; padding: 2px 0 3px 0;cursor: pointer;background: #7D0F0F; color: #FFF;"  class="submit" type="submit" onclick="DoneTest()" name="TestButton" value="Submit Verbal Test"></p>

回答by igr

Check your username and password provided into getConnection function. Verify this username and password from other tool (like sqlplus).
If username and password are ok, verify if alias is correct (if using JDBC OCI) or that host:port/serviceName is correct (or host:port:sid).

For passwords, be sure to use upper case / lower case letters as needed.

检查您提供给 getConnection 函数的用户名和密码。从其他工具(如 sqlplus)验证此用户名和密码。
如果用户名和密码正确,请验证别名是否正确(如果使用 JDBC OCI)或 host:port/serviceName 是否正确(或 host:port:sid)。

对于密码,请务必根据需要使用大写/小写字母。