我在数据库中输入了10个问题及其答案 . 我开始项目,我登录了候选人ID . 在那之后我给了承认id,它被接受了 . 之后我尝试打开这个页面(这个页面打算打开测试页面,这将打开问题),我收到错误信息 - java.sql.SQLException:ORA-01017:用户名/密码无效;登录被拒绝据我所知,项目编码没有错误 . 所以我没有发布编码 . 错误是数据库连接中的某个地方 . (我看过其他主题有这个错误,但找不到帮助) .
{ if(minutes==0 && seconds==0)
{
alert('Oops ! ! Time up '+
'Test Submitted Successfully');
VerbForm.submit();
}
seconds=60;
minutes--;
window.setTimeout("timer()", 1000 );
}
}
" name=" forma“> Time Remaining:
" style="边框:0px纯白色;后台:#F0EFE2 ">:" style = "border:0px solid white; background: #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")%>
<%
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>
1 回答
检查提供给getConnection功能的用户名和密码 . 从其他工具(如sqlplus)验证此用户名和密码 .
如果用户名和密码正常,请验证别名是否正确(如果使用JDBC OCI)或主机:port / serviceName是否正确(或host:port:sid) .
对于密码,请务必根据需要使用大写/小写字母 .