当前位置: 代码迷 >> Oracle管理 >> 本人是oracle菜鸟,用jsp连接时出现ORA-01017: invalid username/password; logon denied异常
  详细解决方案

本人是oracle菜鸟,用jsp连接时出现ORA-01017: invalid username/password; logon denied异常

热度:72   发布时间:2016-04-24 05:03:56.0
本人是oracle初学者,用jsp连接时出现ORA-01017: invalid username/password; logon denied错误
我用的是myeclipse+tomcat
代码如下
<%@ page contentType="text/html; charset=GB2312" %>
<%@ page import="java.sql.*" %>
<html>
  <head>
  <title>使用JDBC直接访问数据库</title>
  </head>
  <body>
  <center>
  <font size="5" color="blue"> 使用JDBC直接访问数据库</font>
  </center>
  <br/>
  <br/>
  <br/>
  <table border="1" align="center">
  <tr>
  <td>卡号</td>
  <td>姓名</td>
  <td>班级</td>
  </tr>
  <%
  Class.forName("oracle.jdbc.driver.OracleDriver");
  String url="jbdc:oracle:thin:@localhost:1521:LKW";//LKW是全局数据库名称
  String user="lkw"; //用户lkw是系统管理员
  String password="9371719"; //这个是密码,这个密码是正确的
  Connection con = DriverManager.getConnection(url,user,password);
  Statement stmt=con.createStatement();
  ResultSet rs=stmt.executeQuery("select * from card");
  while(rs.next()){
  %>
  <tr>
  <td><%=rs.getInt(1) %></td>
  <td><%=rs.getString(2) %></td>
  <td><%=rs.getString(3) %></td>
  </tr>
  <% 
  }
  rs.close();
  con.close();
  %>
  </table>
  </body>
</html>

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

at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.O3log.receive1st(O3log.java:430)
at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:254)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:307)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:442)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:321)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at org.apache.jsp.jdbc_jsp._jspService(jdbc_jsp.java:79)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
  相关解决方案