import java.applet.Applet; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.sql.*; public class muuda extends HttpServlet{ public void doGet(HttpServletRequest kysimus,HttpServletResponse vastus) throws IOException, ServletException{ vastus.setContentType("text/plain"); PrintWriter valja=new PrintWriter(vastus.getWriter()); try{ //public static void main(String argumendid[]) throws Exception{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection cn=DriverManager.getConnection("jdbc:odbc:nimekiri", "", ""); Statement st=cn.createStatement(); String lause="UPDATE loe set loendur=loendur+1 "; st.executeUpdate(lause); String lause1="SELECT loendur from loe;"; ResultSet rs=st.executeQuery(lause1); rs.next(); valja.println("Kokku vaadatud "+rs.getInt("loendur")+" korda."); cn.close(); }catch(Exception viga){ valja.println("Viga andmebaasis!! " +viga); } } }