Guest User

Untitled

a guest
Sep 18th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. <%--
  2. Document : bookdb
  3. Created on : 19 Sep, 2019, 9:29:56 AM
  4. Author : student
  5. --%>
  6. <%@page import="java.io.PrintWriter"%>
  7. <%@page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
  8. <%@page import="java.sql.*" %>
  9. <%
  10. String id=request.getParameter("id");
  11. String title=request.getParameter("title");
  12. String author=request.getParameter("author");
  13. String price=request.getParameter("price");
  14. try{
  15. Class.forName("com.mysql.jdbc.Driver");
  16. Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/a1", "root", "123");
  17. Statement st=conn.createStatement();
  18. st.executeUpdate("insert into book values("+id+",'"+title+"','"+author+"',"+price+")");
  19. }
  20. catch(Exception e){
  21. e.printStackTrace();
  22. }
  23. %>
Add Comment
Please, Sign In to add comment