Advertisement
Guest User

Untitled

a guest
May 21st, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. 1 import java.io.*;
  2. 1 import java.io.*;
  3. 2 import javax.servlet.*;
  4. 3 import javax.servlet.http.*;
  5. 4 import java.util.*;
  6. 5 import java.sql.*;
  7. 6 public class movie extends HttpServlet {
  8. 7
  9. 8 public void doGet(HttpServletRequest request,
  10. 9 HttpServletResponse response)throws ServletException ,IOException {
  11. 10 response.setContentType("text/html");
  12. 11 PrintWriter out = response.getWriter();
  13. 12
  14. 13 String title = "Movie Database";
  15. 14 try{
  16. 15 Class.forName("oracle.jdbc.driver.OracleDriver");
  17. 16 }catch(ClassNotFoundException e){
  18. 17 out.println("CLASS NOT FOUND: "+e.getMessage());
  19. 18 }
  20. 19
  21. 20 try{
  22. 21 Connection con = DriverManager.getConnection("jdbc:oracle:th
  23. in:@oracle.cse.sc.edu:2312:CSE.SC.EDU","username","password");
  24.  
  25. 22 }catch(Exception e){
  26. 23 out.println(e);
  27. 24 }
  28. 25
  29. 26 out.println(
  30. 27
  31. 28 "<BODY>\n"+
  32. 29 "<H1 ALIGN=CENTER>" + title +"</H1>\n"
  33. 30 );
  34. 31
  35. 32 }
  36. 33
  37. 34 public void doPost(HttpServletRequest request,
  38. 35 HttpServletResponse response)
  39. 36 throws ServletException, IOException {
  40. 37 doGet(request,response);
  41. 38 }
  42. 39 }
  43. 40
  44. 41
  45. 42
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement