11
Chapter 9:Chapter 9: The Client/Server The Client/Server
Database EnvironmentDatabase EnvironmentModern Database ManagementModern Database Management
77thth Edition EditionJeffrey A. Hoffer, Mary B. Prescott, Jeffrey A. Hoffer, Mary B. Prescott,
Fred R. McFaddenFred R. McFadden
22Chapter 9
ObjectivesObjectives Definition of termsDefinition of terms List advantages of client/server architectureList advantages of client/server architecture Explain three application components: presentation, Explain three application components: presentation,
processing, and storageprocessing, and storage Suggest partitioning possibilitiesSuggest partitioning possibilities Distinguish between file server, database server, 3-tier, Distinguish between file server, database server, 3-tier,
and n-tier approachesand 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
33Chapter 9
Client/Server SystemsClient/Server Systems
Networked computing modelNetworked computing model Processes distributed between clients and Processes distributed between clients and
serversservers Client – Workstation (usually a PC) that Client – Workstation (usually a PC) that
requests and uses a servicerequests and uses a service Server – Computer (PC/mini/mainframe) Server – Computer (PC/mini/mainframe)
that provides a servicethat provides a service For DBMS, server is a database serverFor DBMS, server is a database server
44Chapter 9
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
55Chapter 9
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
66Chapter 9
File Server ArchitectureFile Server Architecture
All processing is done at the PC that requested All processing is done at the PC that requested the data the data
Entire files are transferred from the server to the Entire files are transferred from the server to the client for processingclient 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 checks, Client DBMSs must recognize shared locks, integrity checks,
etc.etc.
FAT FAT CLIENTCLIENT
77Chapter 9
Figure 9-2: File Server Architecture
FAT FAT CLIENTCLIENT
88Chapter 9
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 and Server performs all data storage and access processing access processing DBMS is only on serverDBMS is only on server
99Chapter 9
Advantages of Two-Tier ApproachAdvantages of Two-Tier Approach
Clients do not have to be as powerfulClients do not have to be as powerful Greatly reduces data traffic on the Greatly reduces data traffic on the
networknetwork Improved data integrity since it is all Improved data integrity since it is all
processed centrallyprocessed centrally Stored proceduresStored procedures some business some business
rules done on serverrules done on server
1010Chapter 9
Advantages of Advantages of Stored ProceduresStored Procedures
Compiled SQL statementsCompiled SQL statementsReduced network trafficReduced network traffic Improved securityImproved security Improved data integrityImproved data integrityThinner clientsThinner clients
1111Chapter 9
Figure 9-3: Two-tier database server architecture
ThinneThinner r clientsclients
DBMS DBMS only on only on serverserver
1212Chapter 9
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
Client
Application server
Database server
1313Chapter 9
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
1414Chapter 9
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
1515Chapter 9
Challenges of Three-tier Challenges of Three-tier ArchitecturesArchitectures
High short-term costsHigh short-term costsTools and trainingTools and trainingExperienceExperience Incompatible standardsIncompatible standardsLack of compatible end-user toolsLack of compatible end-user tools
1616Chapter 9
Application PartitioningApplication Partitioning
Placing portions of the application code in Placing portions of the application code in different locations (client vs. server) different locations (client vs. server) AFTER it is writtenAFTER it is written
AdvantagesAdvantages Improved performanceImproved performance Improved interoperabilityImproved interoperability Balanced workloadsBalanced workloads
1717Chapter 9
Parallel Computer ArchitecturesParallel Computer Architectures
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
1818Chapter 9
Parallel Computer ArchitecturesParallel Computer Architectures
Figure 9-6Tightly coupled – CPUs share common memory space
Figure 9-7Loosely coupled – CPUs each have their own memory space
1919Chapter 9
Query Processing with Query Processing with Parallel ProcessorsParallel Processors
Figure 9-5a:Parallel transactions
Figure 9-5b:Parallel query
2020Chapter 9
Processing Logic DistributionsProcessing Logic Distributions
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
2121Chapter 9
MiddlewareMiddleware
Software which allows an application to Software which allows an application to interoperate 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 Program Interface (API)(API)
The “glue”“glue” that holds client/server applications together
2222Chapter 9
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 and object-oriented management of communications between clients and
serversservers
SQL-oriented Data AccessSQL-oriented Data Access middleware between applications and database serversmiddleware between applications and database servers
2323Chapter 9
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 databasesapplications/applets to connect to databases
2424Chapter 9
Client/Server SecurityClient/Server Security Network environment Network environment complex security complex security
issuesissues 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
2525Chapter 9
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
2626Chapter 9
Figure 9-10: QBE view of a multiple-table join query
Figure 9-12: Equivalent query in SQL
2727Chapter 9
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
2828Chapter 9
Using ODBC to Link External Databases Using ODBC to Link External Databases Stored on a Database ServerStored on a Database Server
Open Database Connectivity (ODBC)Open Database Connectivity (ODBC) API that provides a common language for application programs to API that provides a common language for application programs to
access and process SQL databases independent of the particular access and process SQL databases independent of the particular RDBMS that is accessedRDBMS 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
2929Chapter 9
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
3030Chapter 9
Visual Basic for ApplicationsVisual Basic for Applications VBA is the programming language that VBA is the programming language that
accompanies Access 2000accompanies 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 that Event-driven – nonprocedural programming that detects events and generates appropriate responsesdetects events and generates appropriate responses