<%! String pageTitle = "Trying to Import in-class"; %>
<%@ include file="St10CommonImportTop.jsp" %>

    <%! String username; %>
    <%! String password; %>
    
    <%

    try
    {
        username = request.getParameter("username");
        password = request.getParameter("password");

        Class.forName("oracle.jdbc.driver.OracleDriver");
        Connection con = DriverManager.getConnection
                ("jdbc:oracle:thin:@cedar:1521:student",
                 username, password);
        Statement stmt = con.createStatement();

        int numInserted = stmt.executeUpdate(
            "insert into log_table " +
            "values " +
            "('" + username + "', sysdate)");
    %>

    <h2> How many rows were inserted? <%= numInserted %> </h2>

    <p> How many rows are now in the log_table? 

    <%
        ResultSet rS = stmt.executeQuery("select count(*) " +
	                                 "from log_table");
        rS.next();
    %>
        <%= rS.getInt(1) %> 
    </p>

    <h2> Consider this value: 98.7666645 </h2>
    <h2> Here it is, formatted to 2 fractional places: 
         <%= String.format("%5.2f", 98.7666645) %> </h2>

   <%
       stmt.close();
       con.close();
   }
   catch (Exception exc)
   {
   %>
       <p><%= exc.toString() %> </p>
   <%
   }
   %>

<%@ include file="St10CommonBottom.jsp" %>