Presentation is loading. Please wait.

Presentation is loading. Please wait.

2013 Fall 1 Chapter 9: The Client/Server Database Environment 楊立偉教授 台灣大學工管系 註 : 於 11 版為 Chapter 8.

Similar presentations


Presentation on theme: "2013 Fall 1 Chapter 9: The Client/Server Database Environment 楊立偉教授 台灣大學工管系 註 : 於 11 版為 Chapter 8."— Presentation transcript:

1 2013 Fall 1 Chapter 9: The Client/Server Database Environment 楊立偉教授 台灣大學工管系 註 : 於 11 版為 Chapter 8

2 Chapter 9 2 Client/Server Systems Networked computing model 網路運算模型 Networked computing model 網路運算模型 Processes distributed between clients and servers 將要處理的工作散在 Client 與 Server Processes distributed between clients and servers 將要處理的工作散在 Client 與 Server Client–Workstation (usually a PC) that requests and uses a service Client–Workstation (usually a PC) that requests and uses a service Server–Computer (PC/mini/mainframe) that provides a service Server–Computer (PC/mini/mainframe) that provides a service For DBMS, server is a database server For DBMS, server is a database server

3 Chapter 9 3 Application Logic in C/S Systems GUI (Graphic User Interface) Procedures, functions, programs DBMS activities Processing Logic 處理邏輯 I/O processing I/O processing Business rules Business rules Data management Data management Storage Logic 儲存邏輯 Data storage/retrieval Data storage/retrieval Presentation Logic 呈現邏輯 Input–keyboard/mouse Input–keyboard/mouse Output–monitor/printer Output–monitor/printer

4 Chapter 9 4 3 types of Client/Server Architectures 1.File Server Architecture 1.File Server Architecture 2.Database Server Architecture 2.Database Server Architecture 3.Three-tier Architecture 3.Three-tier Architecture Client does extensive processing Client does little processing

5 Chapter 9 5 1. File Server Architecture All processing is done at the PC that requested the data All processing is done at the PC that requested the data Entire files are transferred from the server to the client for processing Entire files are transferred from the server to the client for processing Ex. 利用網路芳鄰分享 MDB 檔 Problems: Problems: Huge amount of data transfer on the network Huge amount of data transfer on the network Each client must contain full DBMS Each client must contain full DBMS Heavy resource demand on clients Heavy resource demand on clients Client DBMSs must recognize shared locks, integrity checks, etc. Client DBMSs must recognize shared locks, integrity checks, etc. FAT CLIENT

6 Chapter 9 6 Figure 9-2 File server model FAT CLIENT

7 Chapter 9 7 2. Two-Tier Database Server Architectures Client is responsible for Client is responsible for I/O processing logic I/O processing logic Some business rules logic Some business rules logic Server performs all data storage and access processing Server performs all data storage and access processing  DBMS is only on server

8 Chapter 9 8 Advantages of Two-Tier Approach Clients do not have to be as powerful Clients do not have to be as powerful Greatly reduces data traffic on the network Greatly reduces data traffic on the network Improved data integrity since it is all processed centrally Improved data integrity since it is all processed centrally Stored procedures : performs some business rules done on server Stored procedures : performs some business rules done on server 把較常用或重要的程序預先寫好放在 DBMS 內

9 Chapter 9 9 Advantages of Stored Procedures Compiled SQL statements 編譯後執行快 Compiled SQL statements 編譯後執行快 Reduced network traffic 佔較少的網路流量 Reduced network traffic 佔較少的網路流量 Improved security 安全性較高 Improved security 安全性較高 Improved data integrity 資料完整性較高 Improved data integrity 資料完整性較高 Thinner clients 前端運算量較少 Thinner clients 前端運算量較少

10 Chapter 9 10 Figure 9-3 Database server architecture (two-tier) Thinner clients DBMS only on server

11 Chapter 9 11 3. Three-Tier Architectures Thin Client PC just for user interface and a little application processing. Limited or no data storage (sometimes no hard drive) 例如 : Web Browser GUI interface (I/O processing) Browser Business rules Web Server Data storage DBMS Client Application server Database server

12 Chapter 9 12 Figure 9-4a Generic three-tier architecture Thinnest clients Business rules on separate server DBMS only on DB server

13 Chapter 9 13 Advantages of Three-Tier Architectures Scalability Scalability ( 在佈署與效能上 ) 具擴充性 Technological flexibility Technological flexibility 具技術彈性 Long-term cost reduction Long-term cost reduction 長期低本降低 Better match of systems to business needs Better match of systems to business needs 較符合企業所需 Reduced risk Reduced risk 風險降低

14 Chapter 9 14 Application Partitioning Placing portions of the application code in different locations (client vs. server) AFTER it is written 重新切分程式執行的位置 Placing portions of the application code in different locations (client vs. server) AFTER it is written 重新切分程式執行的位置 Advantages Advantages Improved performance Improved performance Improved interoperability Improved interoperability Balanced workloads Balanced workloads

15 Chapter 9 15 Common Logic Distributions Figure 9-5a Two-tier client- server environments Figure 9-5b n-tier client- server environment Processing logic could be at client, server, or both Processing logic will be at application server or Web server

16 Chapter 9 16 Role of the Mainframe 大型主機 Mission-critical legacy systems tend to remain on mainframes Mission-critical legacy systems tend to remain on mainframes When moving mission critical systems from mainframe to distributed client/server systems When moving mission critical systems from mainframe to distributed client/server systems 例如 : 銀行核心系統的移轉 Determining which code belongs on server vs. client Determining which code belongs on server vs. client Identifying potential conflicts with code from other applications Identifying potential conflicts with code from other applications Ensuring sufficient resources exist for anticipated load Ensuring sufficient resources exist for anticipated load Rule of thumb 移轉的經驗法則 Rule of thumb 移轉的經驗法則 Mainframe for centralized data that does not need to be moved Mainframe for centralized data that does not need to be moved Client for data requiring frequent user access, complex graphics, and user interface Client for data requiring frequent user access, complex graphics, and user interface

17 Chapter 9 17 Benefits of Moving to Client/Server Architecture Staged delivery of functionality speeds deployment 功能可分階段完成 Staged delivery of functionality speeds deployment 功能可分階段完成 GUI ease application use 將使用者界面與應用分離 GUI ease application use 將使用者界面與應用分離 Flexibility and scalability facilitates business process reengineering 更容易擴充 具有彈性 Flexibility and scalability facilitates business process reengineering 更容易擴充 具有彈性 Reduced network traffic 只傳處理過的資料 Reduced network traffic 只傳處理過的資料 Facilitation of Web-enabled applications Facilitation of Web-enabled applications 易於轉為 Web 或行動應用

18 Chapter 9 18 Middleware 中介軟體 Software that allows an application to interoperate with other software No need for programmer/user to understand internal processing Accomplished via Application Program Interface (API) “glue” The “glue” that holds client/server applications together

19 Chapter 9 19 Database Middleware ODBC –Open Database Connectivity ODBC –Open Database Connectivity Most DB vendors support this Most DB vendors support this JDBC –Java Database Connectivity JDBC –Java Database Connectivity 可視為 Java 版的 ODBC Special Java classes that allow Java applications/applets to connect to databases Special Java classes that allow Java applications/applets to connect to databases OLE-DB OLE-DB Microsoft enhancement of ODBC Microsoft enhancement of ODBC

20 Chapter 9 20 Using ODBC to Link External Databases Stored on a Database Server Open Database Connectivity (ODBC) Open Database Connectivity (ODBC) API provides a common language for application programs to access and process SQL databases independent of the particular RDBMS that is accessed API provides a common language for application programs to access and process SQL databases independent of the particular RDBMS that is accessed Required parameters: Required parameters: ODBC driver ODBC driver Back-end server name Back-end server name Database name Database name User id and password User id and password Additional information: Additional information: Data source name (DSN) Data source name (DSN) Windows client computer name Windows client computer name Client application program’s executable name Client application program’s executable name

21 Chapter 9 21 ODBC Architecture (Figure 9-6) Each DBMS has its own ODBC-compliant driver Client does not need to know anything about the DBMS Application Program Interface (API) provides common interface to all DBMSs

22 Chapter 9 實作 : 實際設定一個 DSN ( 適用 Windows 作業系統 ) 控制台 → 系統管理工具 → 資料來源 (ODBC) 選「系統資料來源名稱」 → 選「新增」 選一個適當的驅動程式 (Driver)

23 Chapter 9 實際設定一個 DSN ( 續 ) 填入所需資料並選取 Access 的 MDB 檔案,確定即可

24 Chapter 9 使用 ODBC 資料來源 以 MS Access 為例,選檔案 → 取得外部資料 → 匯入 選取 ODBC 來源,選取所需要的 DSN 即可 適用所有支援 ODBC 資料來源的應用程式

25 Chapter 9 Web/DB Application Components Database server – hosts the DBMS Database server – hosts the DBMS e.g. Oracle, MS SQL Server, MS Access, MySQL e.g. Oracle, MS SQL Server, MS Access, MySQL Web server – receives and responds to browser requests using HTTP protocol Web server – receives and responds to browser requests using HTTP protocol e.g. Apache, MS IIS (Internet Information Services) e.g. Apache, MS IIS (Internet Information Services) Application server – software for creating dynamic web sites Application server – software for creating dynamic web sites e.g. MS ASP.NET framework, Java EE, PHP e.g. MS ASP.NET framework, Java EE, PHP Web browser – client program that sends web requests and receives web pages Web browser – client program that sends web requests and receives web pages e.g. Internet Explorer, Firefox, Safari, Google Chrome e.g. Internet Explorer, Firefox, Safari, Google Chrome 25

26 Chapter 9 Static page requests Static page requests.htm or.html requests handled by the Web server.htm or.html requests handled by the Web server Dynamic page requests Dynamic page requests.jsp,.aspx, and.php requests are routed to the application server.jsp,.aspx, and.php requests are routed to the application server Server-side processing by JSP servlet, ASP.NET application, or PHP Server-side processing by JSP servlet, ASP.NET application, or PHP Database access via JDBC, ODBC, ADO.NET, or other database middleware Database access via JDBC, ODBC, ADO.NET, or other database middleware 26

27 Chapter 9 27 Figure Information flow in a three-tier architecture No server side processing, just a page return Server side processing, including database access …also *.aspx or *.php © 2013 Pearson Education


Download ppt "2013 Fall 1 Chapter 9: The Client/Server Database Environment 楊立偉教授 台灣大學工管系 註 : 於 11 版為 Chapter 8."

Similar presentations


Ads by Google