package ForecastingPkg; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; import java.text.*; import java.sql.*; public class ValidateUser extends HttpServlet { /* * Initialize global variables */ String id="",name=""; Connection conn; Statement st; String username=""; /* Initialize the servlet. This is called once when the servlet is loaded * It is guaranted to complete before any requests are made to the servlet * param config Servlet configuration information */ public void init(ServletConfig config) throws ServletException { super.init(config); } /* Connects to the Oracle Database */ public Connection connectToOracle () { try { //Class.forName("oracle.jdbc.driver.OracleDriver"); //String url = "jdbc:oracle:thin:@208.220.122.19:1525:M3TEST"; //conn = DriverManager.getConnection(url,"forecast", "forecast"); String driver = "sun.jdbc.odbc.JdbcOdbcDriver"; // use Jdbc-Odbc-Bridge String url = "jdbc:odbc:ayedduladb"; // as defined in the ODBC Data Source Administrator Class.forName(driver); // load the driver class conn = java.sql.DriverManager.getConnection(url, null, null); // connect to database System.out.println("Connection Established" ); } catch(ClassNotFoundException ce) { System.out.println("Class Not Found Exception" +ce.getMessage()); } catch (SQLException anSQLException) { anSQLException.printStackTrace(); } return conn; } /* Process the HTTP Get request */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try{ username = request.getParameter("employeeName"); response.setContentType("text/html; charset=WINDOWS-1252"); PrintWriter out = response.getWriter(); if (validUserName(username)){ out.println(""); out.println("
"); out.println("