Chapter 9: Application Design and Development
©Silberschatz, Korth and Sudarshan
9.1
Database System Concepts - 6th Edition
Chapter 9: Application Design and Development
©Silberschatz, Korth and Sudarshan
9.2
Database System Concepts - 6th Edition
Application Programs and User Interfaces
©Silberschatz, Korth and Sudarshan
9.3
Database System Concepts - 6th Edition
Application Architecture Evolution
©Silberschatz, Korth and Sudarshan
9.4
Database System Concepts - 6th Edition
Web Interface
©Silberschatz, Korth and Sudarshan
9.5
Database System Concepts - 6th Edition
The World Wide Web
©Silberschatz, Korth and Sudarshan
9.6
Database System Concepts - 6th Edition
Uniform Resources Locators
©Silberschatz, Korth and Sudarshan
9.7
Database System Concepts - 6th Edition
HTML and HTTP
©Silberschatz, Korth and Sudarshan
9.8
Database System Concepts - 6th Edition
Sample HTML Source Text
<html>
<body>
<table border>�<tr> <th>ID</th> <th>Name</th> <th>Department</th> </tr>�<tr> <td>00128</td> <td>Zhang</td> <td>Comp. Sci.</td> </tr>�….
</table>
<form action="PersonQuery" method=get>�Search for: � <select name="persontype">� <option value="student" selected>Student </option>� <option value="instructor"> Instructor </option>� </select> <br>�Name: <input type=text size=20 name="name">�<input type=submit value="submit">
</form>
</body> </html>
©Silberschatz, Korth and Sudarshan
9.9
Database System Concepts - 6th Edition
Display of Sample HTML Source
©Silberschatz, Korth and Sudarshan
9.10
Database System Concepts - 6th Edition
Web Servers
©Silberschatz, Korth and Sudarshan
9.11
Database System Concepts - 6th Edition
Three-Layer Web Architecture
©Silberschatz, Korth and Sudarshan
9.12
Database System Concepts - 6th Edition
Two-Layer Web Architecture
Alternative: two-layer architecture
©Silberschatz, Korth and Sudarshan
9.13
Database System Concepts - 6th Edition
HTTP and Sessions
©Silberschatz, Korth and Sudarshan
9.14
Database System Concepts - 6th Edition
Sessions and Cookies
©Silberschatz, Korth and Sudarshan
9.15
Database System Concepts - 6th Edition
Servlets
©Silberschatz, Korth and Sudarshan
9.16
Database System Concepts - 6th Edition
Example Servlet Code
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class PersonQueryServlet extends HttpServlet {
public void doGet (HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<HEAD><TITLE> Query Result</TITLE></HEAD>");
out.println("<BODY>");
….. BODY OF SERVLET (next slide) …
out.println("</BODY>");
out.close();
}
}
©Silberschatz, Korth and Sudarshan
9.17
Database System Concepts - 6th Edition
Example Servlet Code
String persontype = request.getParameter("persontype");
String number = request.getParameter("name");
if(persontype.equals("student")) {
... code to find students with the specified name ...
... using JDBC to communicate with the database ..
out.println("<table BORDER COLS=3>");
out.println(" <tr> <td>ID</td> <td>Name: </td>" + " <td>Department</td> </tr>");
for(... each result ...){
... retrieve ID, name and dept name
... into variables ID, name and deptname
out.println("<tr> <td>" + ID + "</td>" + "<td>" + name + "</td>" + "<td>" + deptname � + "</td></tr>");
};
out.println("</table>");
}
else {
... as above, but for instructors ...
}
©Silberschatz, Korth and Sudarshan
9.18
Database System Concepts - 6th Edition
Servlet Sessions
©Silberschatz, Korth and Sudarshan
9.19
Database System Concepts - 6th Edition
Servlet Support
©Silberschatz, Korth and Sudarshan
9.20
Database System Concepts - 6th Edition
Server-Side Scripting
©Silberschatz, Korth and Sudarshan
9.21
Database System Concepts - 6th Edition
Java Server Pages (JSP)
<html>
<head> <title> Hello </title> </head>
<body>
<% if (request.getParameter(“name”) == null)
{ out.println(“Hello World”); }
else { out.println(“Hello, ” + request.getParameter(“name”)); }
%>
</body>
</html>
©Silberschatz, Korth and Sudarshan
9.22
Database System Concepts - 6th Edition
PHP
<html>
<head> <title> Hello </title> </head>
<body>
<?php if (!isset($_REQUEST[‘name’]))
{ echo “Hello World”; }
else { echo “Hello, ” + $_REQUEST[‘name’]; }
?>
</body>
</html>
©Silberschatz, Korth and Sudarshan
9.23
Database System Concepts - 6th Edition
Client Side Scripting
©Silberschatz, Korth and Sudarshan
9.24
Database System Concepts - 6th Edition
Client Side Scripting and Security
©Silberschatz, Korth and Sudarshan
9.25
Database System Concepts - 6th Edition
Javascript
©Silberschatz, Korth and Sudarshan
9.26
Database System Concepts - 6th Edition
Javascript
<html> <head>�<script type="text/javascript">� function validate() {� var credits=document.getElementById("credits").value;� if (isNaN(credits)|| credits<=0 || credits>=16) {� alert("Credits must be a number greater than 0 and less than 16");� return false� }� }�</script>
</head> <body>�<form action="createCourse" onsubmit="return validate()">� Title: <input type="text" id="title" size="20"><br />� Credits: <input type="text" id="credits" size="2"><br />� <Input type="submit" value="Submit">�</form>
</body> </html>
©Silberschatz, Korth and Sudarshan
9.27
Database System Concepts - 6th Edition
Application Architectures
©Silberschatz, Korth and Sudarshan
9.28
Database System Concepts - 6th Edition
Application Architectures
©Silberschatz, Korth and Sudarshan
9.29
Database System Concepts - 6th Edition
Application Architecture
©Silberschatz, Korth and Sudarshan
9.30
Database System Concepts - 6th Edition
Business Logic Layer
©Silberschatz, Korth and Sudarshan
9.31
Database System Concepts - 6th Edition
Object-Relational Mapping
©Silberschatz, Korth and Sudarshan
9.32
Database System Concepts - 6th Edition
Object-Relational Mapping and Hibernate (Cont.)
©Silberschatz, Korth and Sudarshan
9.33
Database System Concepts - 6th Edition
Web Services
©Silberschatz, Korth and Sudarshan
9.34
Database System Concepts - 6th Edition
Disconnected Operations
©Silberschatz, Korth and Sudarshan
9.35
Database System Concepts - 6th Edition
Rapid Application Development
©Silberschatz, Korth and Sudarshan
9.36
Database System Concepts - 6th Edition
ASP.NET and Visual Studio
©Silberschatz, Korth and Sudarshan
9.37
Database System Concepts - 6th Edition
Application Performance
©Silberschatz, Korth and Sudarshan
9.38
Database System Concepts - 6th Edition
Improving Web Server Performance
©Silberschatz, Korth and Sudarshan
9.39
Database System Concepts - 6th Edition
Application Security
©Silberschatz, Korth and Sudarshan
9.40
Database System Concepts - 6th Edition
SQL Injection
©Silberschatz, Korth and Sudarshan
9.41
Database System Concepts - 6th Edition
Cross Site Scripting
©Silberschatz, Korth and Sudarshan
9.42
Database System Concepts - 6th Edition
Cross Site Scripting
©Silberschatz, Korth and Sudarshan
9.43
Database System Concepts - 6th Edition
Password Leakage
©Silberschatz, Korth and Sudarshan
9.44
Database System Concepts - 6th Edition
Application Authentication
©Silberschatz, Korth and Sudarshan
9.45
Database System Concepts - 6th Edition
Application Authentication
©Silberschatz, Korth and Sudarshan
9.46
Database System Concepts - 6th Edition
Single Sign-On
©Silberschatz, Korth and Sudarshan
9.47
Database System Concepts - 6th Edition
Application-Level Authorization
create view studentTakes as�select *�from takes�where takes.ID = syscontext.user_id()
©Silberschatz, Korth and Sudarshan
9.48
Database System Concepts - 6th Edition
Application-Level Authorization (Cont.)
©Silberschatz, Korth and Sudarshan
9.49
Database System Concepts - 6th Edition
Audit Trails
©Silberschatz, Korth and Sudarshan
9.50
Database System Concepts - 6th Edition
Encyption
©Silberschatz, Korth and Sudarshan
9.51
Database System Concepts - 6th Edition
Encryption
©Silberschatz, Korth and Sudarshan
9.52
Database System Concepts - 6th Edition
Encryption (Cont.)
Encryption scheme is such that it is impossible or extremely hard to decrypt data given only the public key.
©Silberschatz, Korth and Sudarshan
9.53
Database System Concepts - 6th Edition
Encryption (Cont.)
©Silberschatz, Korth and Sudarshan
9.54
Database System Concepts - 6th Edition
Encryption in Databases
©Silberschatz, Korth and Sudarshan
9.55
Database System Concepts - 6th Edition
Encryption and Authentication
©Silberschatz, Korth and Sudarshan
9.56
Database System Concepts - 6th Edition
End of Chapter
©Silberschatz, Korth and Sudarshan
9.57
Database System Concepts - 6th Edition
Digital Certificates
©Silberschatz, Korth and Sudarshan
9.58
Database System Concepts - 6th Edition
A formatted report
©Silberschatz, Korth and Sudarshan
9.59
Database System Concepts - 6th Edition
Figure 9.11
©Silberschatz, Korth and Sudarshan
9.60
Database System Concepts - 6th Edition
Web Interfaces to Database (Cont.)
©Silberschatz, Korth and Sudarshan
9.61
Database System Concepts - 6th Edition