-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOpenForEDelete.jsp
119 lines (84 loc) · 2.34 KB
/
OpenForEDelete.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<!DOCTYPE HTML>
<%@include file="connectionString.jsp"%>
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Connection"%>
<%@ page import="java.io.*"%>
<%@ page import="java.util.*"%>
<html>
<head>
<title>Graph</title>
<script type="text/javascript">
</script>
<style>
body {
margin: 0;
padding: 0;
overflow: hidden;
}
p {
text-align: center;
overflow: overlay;
position: relative;
}
body {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-image: url('bodyBG.jpg');
background-repeat: no-repeat;
}
</style>
<script type="text/javascript">
</script>
</head>
<body>
<script>
<%
String var = request.getParameter("param");
connectionString cs = new connectionString();
String url = cs.url;
String username = cs.username;
String password = cs.password;
try {
Class.forName("org.postgresql.Driver");
} catch (ClassNotFoundException e) {
System.out.println("Where is your PostgreSQL JDBC Driver? " + "Include in your library path!");
e.printStackTrace();
return;
}
System.out.println("PostgreSQL JDBC Driver Registered!");
java.sql.Connection connection = null;
try {
connection = DriverManager.getConnection(url, username, password);
} catch (Exception e) {
System.out.println("Connection Failed! Check output console");
e.printStackTrace();
return;
}
if (connection != null) {
//System.out.println("Entered fro query");
ResultSet rs = null;
Statement s = connection.createStatement();
String q3 = "SELECT edge_id FROM edge WHERE building_name='lib'";
rs = s.executeQuery(q3);
while (rs.next()) {
System.out.println("Entered while");
String k = rs.getString("edge_id");
//System.out.println(k);
if(k.compareTo(var)==0){
Statement sw = connection.createStatement();
String q2 = "DELETE FROM edge WHERE edge_id='"+var+"'";
sw.executeUpdate(q2);
}
}
} else {
System.out.println("Failed to make connection!");
}%>
</script>
</body>
</html>