summaryrefslogtreecommitdiff
path: root/doc/unit-6.md
blob: c17ba0696702f606e37c03e1809f72ef60753c26 (plain)
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
# Unit 6 Introduction to two-tier and three-tier architectures and the internet database environment

## Section 1: Client/Server architectures and database connection to web applications

Read Chapter 8 "Database Application Development":

* client/server architectures
* databases in a two-tier architecture
* three-tier architectures
* web application components
* databases in three-tier architectures
* key considerations in three-tier applications

### Client/server architectures

 | presentation logic |
 | processing logic (business rules) |
 | storage logic |

> Application Partitioning: the process of assigning portions of application code to client or server
> partitions after it is written to achieve better performance and interoperability (ability of a component to function on different platforms).

> Fat client: A client PC that is responsible for processing presentation logic, extensive application and business rules logic and many DBMS functions.

Two tier architectures

|--------|
| Server | * storage logic
|--------|
| Client | * processing logic
|        | * presentation logic
|--------|

|--------|
| Server | * storage logic
|        | * processing logic
|--------|
| Client | * presentation logic
|--------|


n tier architecture

|--------|
|   db   | * storage logic
|--------|
|  app   | * processing logic
|--------|
| client | * presentation logic
|--------|

|--------|
|   db   | * storage logic (postgresql)
|--------|
|  app   | * processing logic (ruby on rails)
|--------|
|  web   | * processing logic (nginx)
|--------|
| client | * presentation logic (firefox)
|--------|


> database server: A computer that is responsible for database storage,
> access, and processing in a client/server environment.

* middleware: software that allows an application to interoperate with other
  software without requiring the user to understand and code the low-level operations
  necessary to achieve interoperability.

* API: set of routines that an application program uses to direct the performance
  by the computers operating system.

* Open database connectivity (ODBC): An API that provides a common language for 
  application programs to access and process SQL databases independent of the particular DBMS that is accessed.

Connecting to a db:

* identify and register database driver
* open a connection to a database
* execute a query against the database
* process the results of the query
* repeat steps 3-4 as necessary
* close connection to the db

* Three tier architecture: client/server configuration that includes three layers; a client layer, and two server layers.
  * common setup is to have an app server and a database server.

* thin client: an application where the client accessing the application primarily provides
  the user interfaces and some application processing, usually with no or limited local data storage.

## Section 2: XML and Data Exchange on the Internet

Read Chapter 8: "Database Application Development"

* "Extensible Markup Language (XML)"


* XML: a text based markup language used to describe data structures hierarchically, using HTML-like tags.
* XML Schema Definition (XSD): language used for defining XML databases that has been recommended by the W3C.

XSD describes structure, data typing, and validation of a salesperson record.

Storing XML documents:

1. store xml in a relational db by shredding it: store each element in a relational table.
2. store XML as blob: not great for full text search unless the db supports xml datatypes.
3. store XML in db using database specific column datatypes.
4. Store xml using xml databases: this is non-relational database designed specifically for xml.

* XPath: expressions used to locate data in XML documents.
* XQuery: XML transformation language that allows application to query both relational and XML data.
* extensible stylesheet language transformation (XSLT): pretty up xml document display.
* Web services description language (WSDL): xml grammar to describe an public interface for an API.
* Simple Object Access Protocol (SOAP): xml communication protocol. Don't do this. just use json or protocol buffers.
* Service-oriented architecture (SOA): collection of services that communicate with each other in some manner, usually by passing data or coordinating a business activity.