forked from halnigalni/DB_Team3_Phase4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Address_fin.jsp
49 lines (43 loc) · 1.36 KB
/
Address_fin.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
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<%@ page language = "java" import ="java.text.*, java.sql.*, java.util.ArrayList"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR" />
<title>KNU MOVIE_TEAM3</title>
</head>
<body>
<%
String serverIP = "localhost";
String strSID = "orcl";
String portNum = "1521";
String user = "university";
String pass = "comp322";
String url = "jdbc:oracle:thin:@"+serverIP+":"+portNum+":"+strSID;
String newAddress = request.getParameter("changeAddress");
String inputId = (String)session.getAttribute("cus_id");
String sql= "";
Connection conn = null;
Statement stmt;
Class.forName("oracle.jdbc.driver.OracleDriver");
conn=DriverManager.getConnection(url,user,pass);
try{
conn.setAutoCommit(false);
stmt = conn.createStatement();
sql = "update account set address = '"+newAddress+"' where Account_id = '"+inputId+"'";
ResultSet rs = stmt.executeQuery(sql);
conn.commit();
}catch(SQLException ex) {System.out.println(ex.getMessage());}
finally {
try {
conn.setAutoCommit(false);
stmt = conn.createStatement();
stmt.close();
conn.close();
}catch(SQLException ex) {
}
}
%>
</body>
</html>