欢迎来到天天文库
浏览记录
ID:14714796
大小:44.50 KB
页数:8页
时间:2018-07-30
《oracle临时员工管理代码》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、packageoracle.course.servlets;importjava.io.IOException;importjava.io.PrintWriter;importjavax.servlet.RequestDispatcher;importjavax.servlet.ServletException;importjavax.servlet.annotation.WebServlet;importjavax.servlet.http.HttpServlet;importjavax.servlet.http.HttpServletReq
2、uest;importjavax.servlet.http.HttpServletResponse;/***ServletimplementationclassLogin*/@WebServlet("/Login")publicclassLoginextendsHttpServlet{privatestaticfinallongserialVersionUID=1L;publicLogin(){}protectedvoiddoGet(HttpServletRequestrequest,HttpServletResponseresponse)th
3、rowsServletException,IOException{}protectedvoiddoPost(HttpServletRequestrequest,HttpServletResponseresponse)throwsServletException,IOException{Stringusername=request.getParameter("username");Stringpassword=request.getParameter("password");if(username.equals("li")&&password.e
4、quals("111")){RequestDispatcherdispatcher=request.getRequestDispatcher("search.jsp");dispatcher.forward(request,response);}else{RequestDispatcherdispatcher=request.getRequestDispatcher("loginfailed.html");dispatcher.forward(request,response);}}}packageoracle.course.data;impo
5、rtjava.sql.CallableStatement;importjava.sql.Connection;importjava.sql.DriverManager;importjava.sql.ResultSet;importjava.sql.SQLException;importjava.sql.Statement;importjava.util.ArrayList;importjava.util.List;publicclassDbConnimplementsDbHandler{//成员变量Connectionconnection=nu
6、ll;//连接ResultSetrSet=null;//结果集Statementstm=null;//语句对象CallableStatementproc=null;publicDbConn(){try{Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();}catch(InstantiationExceptione){e.printStackTrace();}catch(IllegalAccessExceptione){e.printStackTrace();}catch(
7、ClassNotFoundExceptione){e.printStackTrace();}System.out.println("1连接……");try{connection=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:test","sysassysdba","111");}catch(SQLExceptione){e.printStackTrace();System.out.println("错误信息:"+e.toString());}System.out.pr
8、intln("2连接……");try{stm=connection.createStatement(ResultSet.TYPE_SCROLL_INS
此文档下载收益归作者所有