Guest User

Untitled

a guest
Mar 6th, 2017
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. <%--
  2. Document : data
  3. Created on : Mar 6, 2017, 4:00:32 PM
  4. Author : admin
  5. --%>
  6.  
  7. <%@page contentType="text/html" pageEncoding="UTF-8"%>
  8. <!DOCTYPE html>
  9. <html>
  10. <head>
  11. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  12. <title>Database</title>
  13. <%@page import="java.sql.*"%>
  14.  
  15. </head>
  16. <body>
  17. <%
  18. Statement stmt;
  19. Connection con;
  20. ResultSet rs;
  21. try
  22. {
  23. Class.forName("oracle.jdbc.driver.OracleDriver");
  24. con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","system","system");
  25. stmt = con.createStatement();
  26. stmt.executeQuery("create table happy(Name varchar(25),Rollno varchar(15))");
  27. out.println("Created");
  28. rs = stmt.executeQuery("insert into happy values('KRISHNA','TE306362')");
  29. if(rs.next())
  30. {
  31. out.println("inserted");
  32. }
  33. else
  34. {
  35. out.println("Not Inserted");
  36. }
  37. }
  38. catch(Exception e)
  39. {
  40. out.println("Error"+e);
  41. }
  42. %>
  43.  
  44.  
  45.  
  46. </body>
  47. </html>
Add Comment
Please, Sign In to add comment