import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.sql.*; public class Videobaas2 extends HttpServlet{ public void doGet(HttpServletRequest kysimus, HttpServletResponse vastus) throws IOException, ServletException{ vastus.setContentType("text/plain"); PrintWriter valja=new PrintWriter( vastus.getWriter()); try{ // String kood=kysimus.getParameter("kood"); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection cn=DriverManager.getConnection( "jdbc:odbc:yhendus2", "", ""); Statement st=cn.createStatement(); String lause="SELECT * FROM video"; ResultSet rs=st.executeQuery(lause); while(rs.next()){ valja.println(rs.getString("pealkiri")+", "+rs.getString("zanr")+", "+rs.getString("tutvustus")); } }catch(Exception viga){ valja.println("Probleem andmebaasiga: " +viga); } } }