import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.sql.*; import java.util.*; public class AlbumEdasiFoto extends HttpServlet{ public void doGet(HttpServletRequest kysimus, HttpServletResponse vastus) throws IOException, ServletException{ vastus.setContentType("text/plain"); PrintWriter valja=new PrintWriter(vastus.getWriter()); Enumeration loetelu=kysimus.getParameterNames(); String parameeter=""; while(loetelu.hasMoreElements()){ parameeter=(String)loetelu.nextElement(); } try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection cn= DriverManager.getConnection("jdbc:odbc:inimesed", "", ""); Statement st=cn.createStatement(); //String lause="SELECT autor,kaart FROM postkaart"; //ResultSet rs=st.executeQuery(lause); String pilditegija=kysimus.getParameter("pildiautor"); String pildiURL=kysimus.getParameter("URL"); String lause2="INSERT INTO postkaart (autor, kaart) values ('"+pilditegija+"', '"+pildiURL+"')"; st.executeUpdate(lause2); valja.println( "<==Postkaardimaailm==>\n"+ "

Soovitud kaart lisatud

\n"); valja.println(""); valja.println(""); valja.println(""); }catch(Exception viga){ valja.println("Probleem andmebaasiga: " +viga); } } }