import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.net.*; import java.sql.*; public class nimevaljastus6 extends HttpServlet{ public void doGet( HttpServletRequest kysimus, HttpServletResponse vastus ) throws IOException, ServletException{ PrintWriter valja=vastus.getWriter(); try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection cn=DriverManager.getConnection("jdbc:odbc:baasiyhendus1"); Statement st=cn.createStatement(); String lause="SELECT id, maakond FROM maakonnad"; ResultSet rs=st.executeQuery(lause); valja.println("Maakondade loetelu"); valja.println("
"); cn.close(); }catch(Exception viga){ viga.printStackTrace(valja); } valja.println("Valmis"); } } // select * from inimandmed order by perenimi