import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
public class Laulud3 extends HttpServlet {
public void doGet(HttpServletRequest kysimus,
HttpServletResponse vastus)
throws IOException, ServletException
{
vastus.setContentType("text/html");
PrintWriter valja = vastus.getWriter();
valja.println("");
valja.println("
");
valja.println("");
valja.println("Laulude nimekiri\n");
valja.println("");
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection cn=DriverManager.getConnection(
"jdbc:odbc:esimene", "", "");
Statement st=cn.createStatement();
String lause="SELECT pealkiri, esitaja FROM laulud";
ResultSet rs=st.executeQuery(lause);
valja.println("");
while(rs.next()){
valja.println(""+rs.getString("pealkiri")+
" | "+rs.getString("esitaja")+" |
");
}
valja.println("
");
cn.close();
valja.println("");
valja.println("");
}catch(Exception viga){
viga.printStackTrace(valja);
}
}
}