Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%--
- Document : bookdb
- Created on : 19 Sep, 2019, 9:29:56 AM
- Author : student
- --%>
- <%@page import="java.io.PrintWriter"%>
- <%@page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
- <%@page import="java.sql.*" %>
- <%
- String id=request.getParameter("id");
- String title=request.getParameter("title");
- String author=request.getParameter("author");
- String price=request.getParameter("price");
- try{
- Class.forName("com.mysql.jdbc.Driver");
- Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/a1", "root", "123");
- Statement st=conn.createStatement();
- st.executeUpdate("insert into book values("+id+",'"+title+"','"+author+"',"+price+")");
- }
- catch(Exception e){
- e.printStackTrace();
- }
- %>
Add Comment
Please, Sign In to add comment