oracle数据库错误无效的列索引

package com.ringmeup;

import javax.servlet.http.*;
import java.io.*;
import java.sql.*;

public class LoginCl extends HttpServlet {
  public void doGet (HttpServletRequest req,HttpServletResponse res) {
  
  //业务逻辑
  Connection ct= null;
  Statement st=null;
  ResultSet rs=null;
  try {
   String user = req.getParameter("username");
   String psw = req.getParameter("psw");
   //connect the oracle
   Class.forName("oracle.jdbc.driver.OracleDriver");
   //get the connection
   ct = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:orcl","scott","tiger");
   //create the statement
   
   st = ct.createStatement();
   rs = st.executeQuery("select passwd from ringupuser where username='"+user+"'");
   
   if(rs.next()) {
    String dbPasswd = rs.getString(3);
    if(dbPasswd.equals(psw)){
     
     //将验证成功的信息写入session;
    //得到session
    HttpSession hs = req.getSession(true);
    //修改session的存在时间;
    hs.setMaxInactiveInterval(20);
    hs.setAttribute("pass","ok"); 
        
    res.sendRedirect("Wel?uname="+user+"&upsw="+psw);
     
    }
   }else {
    
    res.sendRedirect("login");
    
    }
   }catch (Exception ex) {
    
   ex.printStackTrace();
   
   }finally {
   
    try {
     if(rs!=null)rs.close();
     if(st!=null)st.close();
     if(ct!=null)ct.close();
     
    }catch(Exception ex) {
     ex.printStackTrace();
    }  
   }

 }
  //处理post请求
  //req用于获得客户端的信息
   //res 用于向客户端(浏览器)返回信息
  public void doPost (HttpServletRequest req,HttpServletResponse res) {
   this.doGet(req,res);
  }
}

你可能感兴趣的:(oracle,sql,http,servlet)