-
Notifications
You must be signed in to change notification settings - Fork 0
/
query_3.jsp
40 lines (39 loc) · 1.02 KB
/
query_3.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@page import="java.sql.*" %>
<%@page import="java.io.*" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<h3>Delete a book in BOOK table. Update the contents of other tables to reflect
this data manipulation operation.</h3>
<%
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/library","root","ROOT");
Statement st=con.createStatement();
st.executeUpdate("delete from BOOK where Book_id='4'");
ResultSet rs=st.executeQuery("select * from BOOK");
%>
<h5>Book_id Title Publisher name Publication year</h5>
<%
while(rs.next())
{
String bid=rs.getString("Book_id");
String t=rs.getString("Title");
String pn=rs.getString("Publisher_name");
int py=rs.getInt("Pub_year");
%>
<p>
<%=bid%>
<%=t %>
<%=pn %>
<%=py%>
</p>
<%}
%>
</body>
</html>