Client-server database systems and ODBC l Client-server
architecture and components l More on reliability and security l
ODBC standard
Slide 3
Database processing functions
Slide 4
The client-server architecture l The network cut is between
applications and the DBMS l Database processing is on the
server
Slide 5
DBMS Driver l Receive processing requests from applications l
Format requests and deliver to DBMS l Receive responses from DBMS l
Format responses for application l Communication layer on client
and server to exchange messages between DBMS and driver
Slide 6
Roles of client and server Client Manage the user interface
Enforce business rules Process application logic Generate database
requests (SQL) Transmit database requests to server Receive results
from server Format results Server Accept database request from
clients Process database requests Format results and transmit to
client Enforce business rules Perform integrity checking Maintain
database overhead data Provide concurrent access control Provide
recovery and security services
Slide 7
Advantages & disadvantages l Pro Applications use client
CPUs in parallel More powerful applications Network traffic is
reduced l Con Concurrency control Multiple client OSs
Slide 8
Multithreading
Slide 9
Client requests l Native library calls (API) DBMS-specific l
Embedded SQL Static SQL SQL structure fixed at compile time Faster
Dynamic SQL SQL structure determined at run time More flexible
Slide 10
Business rules: client-enforcement
Slide 11
Business rules: server-enforcement
Slide 12
Enforcement of business rules l Client Triggers Duplication
What about using DML directly? l Server All in one place What if
DBMS cannot enforce business rules?
Slide 13
Concurrency control l Pessimistic locking Assume things will go
wrong Prevent problems all the time l Optimistic locking Assume
things will go well If problem, do it over
Slide 14
Pessimistic locking: same page, different records
Slide 15
Optimistic locking: same page, different records What if same
record?
Slide 16
Concurrency control, take 2 l Pessimistic versus optimistic
locking, which is better? Depends on application... What is the
common case? If conflict is frequent, use pessimistic! If conflict
is rare, use optimistic!
Slide 17
ODBC l Open DataBase Connectivity l Industry-standard interface
between client applications and server DBMS products l The idea is
to write DBMS-independent applications, as long as they conform to
the ODBC standard l To conform or not to conform?
Slide 18
ODBC architecture
Slide 19
ODBC components l On the server: Data source(s) - database,
DBMS, OS, network platform l On the client: DBMS drivers - one per
data source Receive ODBC request Process if not standard SQL Submit
to specific data source Driver manager - one per client Receive
ODBC request from application Load appropriate driver and forward
request
Slide 20
ODBC drivers l Single-tier: process both ODBC calls and SQL
statements l Multiple-tier: process ODBC calls and pass SQL
statements to data source