import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.sql.*;
public class kirjutaja extends HttpServlet{
	Connection cn;
	Statement st;
	public void doGet(HttpServletRequest kysimus, HttpServletResponse vastus) throws IOException, ServletException{
		PrintWriter valja = vastus.getWriter();
		String kell=kysimus.getParameter("kell");
		int pid=Integer.parseInt(kysimus.getParameter("pid"));
		int sid=Integer.parseInt(kysimus.getParameter("sid"));
		String tulemus=kysimus.getParameter("tulemus");
		valja.println("<html><head>Andmete lisamine</head><body>");
		try{
			Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
			cn=DriverManager.getConnection("jdbc:odbc:andmed", "", "");
			st=cn.createStatement();
			st.executeUpdate("INSERT INTO vaatlusandmed (kellaaeg, punkti_ID, suuruse_ID, Tulemus) VALUES ('"+kell+"',"+pid+","+sid+",'"+tulemus+"')");
			cn.close();
		}catch(Exception e){valja.println(e+"");}
		valja.println("ÕNNESTUS");
		valja.println("</body></html>");
	}	
}