© 2005 by prentice hall 1 chapter 9: the client/server database environment modern database...
TRANSCRIPT
© 2005 by Prentice Hall© 2005 by Prentice Hall 11
Chapter 9:Chapter 9: The Client/Server The Client/Server
Database EnvironmentDatabase Environment
Modern Database Modern Database ManagementManagement
77thth Edition EditionJeffrey A. Hoffer, Mary B. Prescott, Jeffrey A. Hoffer, Mary B. Prescott,
Fred R. McFaddenFred R. McFadden
Chapter 9 © 2005 by Prentice Hall© 2005 by Prentice Hall 22
ObjectivesObjectives Definition of termsDefinition of terms List advantages of client/server architectureList advantages of client/server architecture Explain three application components: Explain three application components:
presentation, processing, and storagepresentation, processing, and storage Suggest partitioning possibilitiesSuggest partitioning possibilities Distinguish between file server, database server, Distinguish between file server, database server,
3-tier, and n-tier approaches3-tier, and n-tier approaches Describe and discuss middlewareDescribe and discuss middleware Explain query-by-example (QBE)Explain query-by-example (QBE) Explain database linking via ODBC and JDBCExplain database linking via ODBC and JDBC Explain VBA and Microsoft AccessExplain VBA and Microsoft Access
Chapter 9 © 2005 by Prentice Hall© 2005 by Prentice Hall 33
Client/Server SystemsClient/Server Systems
Networked computing modelNetworked computing model Processes distributed between clients Processes distributed between clients
and serversand servers Client – Workstation (usually a PC) that Client – Workstation (usually a PC) that
requests and uses a servicerequests and uses a service Server – Computer Server – Computer
(PC/mini/mainframe) that provides a (PC/mini/mainframe) that provides a serviceservice
For DBMS, server is a database serverFor DBMS, server is a database server
Chapter 9 © 2005 by Prentice Hall© 2005 by Prentice Hall 44
Application Logic in C/S Application Logic in C/S SystemsSystems
GUI Interface
Procedures, functions,programs
DBMS activities
Processing LogicProcessing Logic I/O processingI/O processing Business rulesBusiness rules Data managementData management
Storage LogicStorage Logic Data storage/retrievalData storage/retrieval
Presentation LogicPresentation Logic Input – keyboard/mouseInput – keyboard/mouse Output – monitor/printerOutput – monitor/printer
Chapter 9 © 2005 by Prentice Hall© 2005 by Prentice Hall 55
Client/Server ArchitecturesClient/Server Architectures
File Server ArchitectureFile Server Architecture
Database Server ArchitectureDatabase Server Architecture
Three-tier ArchitectureThree-tier Architecture
Client does extensive processing
Client does little processing
Chapter 9 © 2005 by Prentice Hall© 2005 by Prentice Hall 66
File Server ArchitectureFile Server Architecture
All processing is done at the PC that All processing is done at the PC that requested the data requested the data
Entire files are transferred from the server Entire files are transferred from the server to the client for processingto the client for processing
Problems:Problems: Huge amount of data transfer on the networkHuge amount of data transfer on the network Each client must contain full DBMS Each client must contain full DBMS
Heavy resource demand on clientsHeavy resource demand on clients Client DBMSs must recognize shared locks, integrity Client DBMSs must recognize shared locks, integrity
checks, etc.checks, etc.
FAT FAT CLIENTCLIENT
Chapter 9 © 2005 by Prentice Hall© 2005 by Prentice Hall 77
Figure 9-2: File Server Architecture
FAT FAT CLIENTCLIENT
Chapter 9 © 2005 by Prentice Hall© 2005 by Prentice Hall 88
Two-Tier Database Server Two-Tier Database Server ArchitecturesArchitectures
Client is responsible for Client is responsible for I/O processing logic I/O processing logic Some business rules logicSome business rules logic
Server performs all data storage Server performs all data storage and access processing and access processing DBMS is only on serverDBMS is only on server
Chapter 9 © 2005 by Prentice Hall© 2005 by Prentice Hall 99
Advantages of Two-Tier Advantages of Two-Tier ApproachApproach
Clients do not have to be as Clients do not have to be as powerfulpowerful
Greatly reduces data traffic on the Greatly reduces data traffic on the networknetwork
Improved data integrity since it is Improved data integrity since it is all processed centrallyall processed centrally
Stored proceduresStored procedures some some business rules done on serverbusiness rules done on server
Chapter 9 © 2005 by Prentice Hall© 2005 by Prentice Hall 1010
Advantages of Advantages of Stored ProceduresStored Procedures
Compiled SQL statementsCompiled SQL statements Reduced network trafficReduced network traffic Improved securityImproved security Improved data integrityImproved data integrity Thinner clientsThinner clients
Chapter 9 © 2005 by Prentice Hall© 2005 by Prentice Hall 1111
Figure 9-3: Two-tier database server architecture
ThinneThinner r clientsclients
DBMS DBMS only on only on serverserver
Chapter 9 © 2005 by Prentice Hall© 2005 by Prentice Hall 1212
Three-Tier ArchitecturesThree-Tier Architectures
Thin Client PC just for user interface and a little application
processing. Limited or no data storage (sometimes no hard drive)
GUI interface (I/O processing)
Browser
Business rules Web Server
Data storage DBMS
ClientClient
Application serverApplication server
Database serverDatabase server
Chapter 9 © 2005 by Prentice Hall© 2005 by Prentice Hall 1313
Figure 9-4: Three-tier architecture
Thinnest Thinnest clientsclients
Business rules on Business rules on separate serverseparate server
DBMS only DBMS only on DB serveron DB server
Chapter 9 © 2005 by Prentice Hall© 2005 by Prentice Hall 1414
Advantages of Three-Tier Advantages of Three-Tier ArchitecturesArchitectures
ScalabilityScalability Technological flexibilityTechnological flexibility Long-term cost reductionLong-term cost reduction Better match of systems to business Better match of systems to business
needsneeds Improved customer serviceImproved customer service Competitive advantageCompetitive advantage Reduced riskReduced risk
Chapter 9 © 2005 by Prentice Hall© 2005 by Prentice Hall 1515
Challenges of Three-tier Challenges of Three-tier ArchitecturesArchitectures
High short-term costsHigh short-term costs Tools and trainingTools and training ExperienceExperience Incompatible standardsIncompatible standards Lack of compatible end-user Lack of compatible end-user
toolstools
Chapter 9 © 2005 by Prentice Hall© 2005 by Prentice Hall 1616
Application PartitioningApplication Partitioning
Placing portions of the application Placing portions of the application code in different locations (client vs. code in different locations (client vs. server) AFTER it is writtenserver) AFTER it is written
AdvantagesAdvantages Improved performanceImproved performance Improved interoperabilityImproved interoperability Balanced workloadsBalanced workloads
Chapter 9 © 2005 by Prentice Hall© 2005 by Prentice Hall 1717
Parallel Computer Parallel Computer ArchitecturesArchitectures
Tightly CoupledTightly Coupled Symmetric Multiprocessing (SMP)Symmetric Multiprocessing (SMP) Multiple CPUsMultiple CPUs Shared RAMShared RAM
Loosely CoupledLoosely Coupled Massively Parallel Processing (MPP)Massively Parallel Processing (MPP) Multiple CPUsMultiple CPUs Each CPU has its own RAM spaceEach CPU has its own RAM space
Chapter 9 © 2005 by Prentice Hall© 2005 by Prentice Hall 1818
Parallel Computer Parallel Computer ArchitecturesArchitectures
Figure 9-6Tightly coupled – CPUs share common memory space
Figure 9-7Loosely coupled – CPUs each have their own memory space
Chapter 9 © 2005 by Prentice Hall© 2005 by Prentice Hall 1919
Query Processing with Query Processing with Parallel ProcessorsParallel Processors
Figure 9-5a:Parallel transactions
Figure 9-5b:Parallel query
Chapter 9 © 2005 by Prentice Hall© 2005 by Prentice Hall 2020
Processing Logic Processing Logic DistributionsDistributions
Two-tier distributions
n-tier distributions
Processing logic could be at client, server, or both
Processing logic will be at application server or Web server
Chapter 9 © 2005 by Prentice Hall© 2005 by Prentice Hall 2121
MiddlewareMiddleware
Software which allows an application Software which allows an application to to interoperateinteroperate with other software with other software
No need for programmer/user to No need for programmer/user to understand internal processingunderstand internal processing
Accomplished via Accomplished via Application Application Program InterfaceProgram Interface (API)(API)
The “glue”“glue” that holds client/server applications together
Chapter 9 © 2005 by Prentice Hall© 2005 by Prentice Hall 2222
Types of MiddlewareTypes of Middleware Remote Procedure Calls (RPC) Remote Procedure Calls (RPC)
client makes calls to procedures running on remote computersclient makes calls to procedures running on remote computers synchronous and asynchronoussynchronous and asynchronous
Message-Oriented Middleware (MOM) Message-Oriented Middleware (MOM) asynchronous calls between the client via message queuesasynchronous calls between the client via message queues
Publish/SubscribePublish/Subscribe push technology push technology server sends information to client when available server sends information to client when available
Object Request Broker (ORB)Object Request Broker (ORB) object-oriented management of communications between clients object-oriented management of communications between clients
and serversand servers SQL-oriented Data AccessSQL-oriented Data Access
middleware between applications and database serversmiddleware between applications and database servers
Chapter 9 © 2005 by Prentice Hall© 2005 by Prentice Hall 2323
Database MiddlewareDatabase Middleware ODBCODBC – Open Database Connectivity – Open Database Connectivity
Most DB vendors support thisMost DB vendors support this
OLE-DBOLE-DB Microsoft enhancement of ODBCMicrosoft enhancement of ODBC
JDBCJDBC – Java Database Connectivity – Java Database Connectivity Special Java classes that allow Java Special Java classes that allow Java
applications/applets to connect to applications/applets to connect to databasesdatabases
Chapter 9 © 2005 by Prentice Hall© 2005 by Prentice Hall 2424
Client/Server SecurityClient/Server Security Network environment Network environment complex complex
security issuessecurity issues Security levels:Security levels:
System-level password securitySystem-level password security for allowing access to the systemfor allowing access to the system
Database-level password securityDatabase-level password security for determining access privileges to tables; for determining access privileges to tables;
read/update/insert/delete privilegesread/update/insert/delete privileges Secure client/server communication Secure client/server communication
via encryptionvia encryption
Chapter 9 © 2005 by Prentice Hall© 2005 by Prentice Hall 2525
Query-by-Example (QBE)Query-by-Example (QBE)
Direct-manipulation database languageDirect-manipulation database language Graphical approachGraphical approach Available in MS AccessAvailable in MS Access MS Access translates QBE to SQL and vice MS Access translates QBE to SQL and vice
versaversa Useful for end-user database programmingUseful for end-user database programming Good for ad hoc processing and prototypingGood for ad hoc processing and prototyping
Chapter 9 © 2005 by Prentice Hall© 2005 by Prentice Hall 2626
Figure 9-10: QBE view of a multiple-table join query
Figure 9-12: Equivalent query in SQL
Chapter 9 © 2005 by Prentice Hall© 2005 by Prentice Hall 2727
Figure 9-9: Access usability hierarchy
Foundation of MS Access
Simple processes
Stored modules of pre-existing VBA code
Visual Basic for Applications…language for customizing the application
API to call functions in DLLs external to MS Access
Chapter 9 © 2005 by Prentice Hall© 2005 by Prentice Hall 2828
Using ODBC to Link External Using ODBC to Link External Databases Stored on a Database Databases Stored on a Database
ServerServer Open Database Connectivity (ODBC)Open Database Connectivity (ODBC) API that provides a common language for application programs API that provides a common language for application programs
to access and process SQL databases independent of the to access and process SQL databases independent of the particular RDBMS that is accessedparticular RDBMS that is accessed
Required parameters:Required parameters: ODBC driver ODBC driver Back-end server nameBack-end server name Database nameDatabase name User id and passwordUser id and password
Additional information:Additional information: Data source name (DSN)Data source name (DSN) Windows client computer nameWindows client computer name Client application program’s executable nameClient application program’s executable name
Java Database Connectivity (JDBC) is similar to ODBC – built specifically for Java applications
Chapter 9 © 2005 by Prentice Hall© 2005 by Prentice Hall 2929
ODBC Architecture ODBC Architecture (Figure 9-18)(Figure 9-18)
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
Chapter 9 © 2005 by Prentice Hall© 2005 by Prentice Hall 3030
Visual Basic for ApplicationsVisual Basic for Applications VBA is the programming language VBA is the programming language
that accompanies Access 2000that accompanies Access 2000 VBA provides these features:VBA provides these features:
Ability to perform complex functionalityAbility to perform complex functionality Error handlingError handling Faster execution than macrosFaster execution than macros Easier maintenanceEasier maintenance OLE automationOLE automation Programmatic controlProgrammatic control Ease of reading for programmersEase of reading for programmers
Event-driven – nonprocedural programming Event-driven – nonprocedural programming that detects events and generates appropriate that detects events and generates appropriate responsesresponses