32
Kittiphan Techakittiroj (30 มม.ม. Database Servers Kittiphan Techakittiroj [email protected]

Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj [email protected]

Embed Size (px)

Citation preview

Page 1: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

Database Servers

Kittiphan Techakittiroj

[email protected]

Page 2: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

• Introduction to database servers

• SQL: the language for database

• SQL Middleware

• Database Server Architectures

Agenda

Page 3: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

Introduction to Database Servers• Send one command to server: SQL Request

• Server processes the request

• Information sent back from server

Page 4: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

• Huge Market --> $$ Money $$

• SQL is most common language

• SQL is standard, but its extensions is not

Current SituationIntroduction to Database Servers

Page 5: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

SQL• Structured Query Language

• “English-Like” language to manipulate

Database

• You tells the server what you need by using

SQL as the communication language

• Server interprets SQL command and find the

way to get the data (how to get the data)

Page 6: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

SQL cont.

• Create by Mathematician

• Well-defined language based on set-theory

• Powerful & Flexible commands

• Store, Retrieve and Process

• Process = Query, Combining, Calculation

(summation)

• ISO SQL, ANSI SQL-89, ANSI SQL-92

Page 7: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

• Interactive query langauge for general database quer

ies: for end-user, specially new GUI systems

• Database programming language: embedded in many l

anguages

• Data definition language and data administration La

nguage: contain both define database and manipulate datab

ase

• Language for networked database servers and multi

user environment

Characteristics of SQLSQL

Page 8: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

• Jointly by ANSI and ISO

• SQL-89: starting point of standard SQL

• SQL-92: serious defined of standard SQL

• SQL-3: future trend but may be too much

SQL StandardSQL

Page 9: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

• SQL-89: defined according to existing products to

make it widely acceptable

• SQL-92: current implementation. At first, difficult

to implement so it contains three levels of

compliance (entry, intermediate and full)

• SQL-3: contain a lot of feature. Not-yet-standard

and will use time to build products.

Details of SQL StandardSQL: SQL Standard

Page 10: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

• Vendors try to add more functionality

• Standard becomes a minimum requirement

• Using extensions of SQL:

– higher performance

– easier in programming

– lose compatibility

SQL ExtensionsSQL: SQL Standard

Page 11: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

SQL Middleware

• API (Application Programming Interface)

• Help developers for

– communicate with the server easier

– create front-end client easier

• supporting multiple client platforms

• supporting multiple server platforms

• make the differences disappear by becoming a

transparent middleware

Page 12: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

• The complete systems contain

– Proprietary SQL API for multiple client-platforms

– Proprietary SQL driver to interface with SQL servers

– Supporting for multiple protocol stacks (e.g. TCP/IP)

Single Vendor SolutionSQL Middleware

Page 13: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

• Extra functionality

– Gateways to other vendor databases: usually multi-tier

– Client/Server database administration tools

– GUI application developments: I recommend third-party

Single Vendor Solution cont.

SQL Middleware

Page 14: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

• Facing Problems:

– Different SQL APIs

– Multiple database drivers

Multi-vendor SolutionSQL Middleware

Page 15: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

• Facing Problems:

– Multiple FAPs and no interoperability

– Multipble administartion tools

Multi-vendor Solution cont.

SQL Middleware

Page 16: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

• Try to eliminate the need of “multiple”

• Three strategies:

– Common SQL Interface

– Open SQL Gateway

– Standard SQL Systems

Middleware SolutionSQL Middleware

Page 17: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

• Commonly use: nothing to do with server

• Need the common SQL API: there are many!

• Need multiple drivers

• Required multiple managing stations FAPs

Common SQL InterfaceSQL Middleware: Middleware Solution

Page 18: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

• Standardize more portion on the client

• Need the gateway server

Open SQL GatewaySQL Middleware: Middleware Solution

Page 19: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

• All Vendors have the same things

• Big Politic issues

Standard SQL SystemsSQL Middleware: Middleware Solution

Page 20: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

• Application

Programming

Interface

• Help developing

programs

• Embedded SQL &

SQL Call-Level

Interface

APISQL Middleware

Page 21: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

• SQL within COBOL,

FORTRAN, C, …

• Defined by ISO SQL-92

• SQL becomes part of

the language

• After compilation

become specific to a

single database vendor

Embedded SQLSQL Middleware: API

Page 22: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

• SQL is not embedded

into part of the program

• Interface to the “CLI

library” is included in

the program

• Allow users to change

database vendors by

changing “CLI library”

SQL Call-Level InterfacesSQL Middleware: API

Page 23: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

• Common Standard is SAG CLI

• Contains the SQL style procedure calls

• ODBC is grown from SAG CLI

– from Microsoft

– ODBC 1.0 was slow and buggy

– ODBC 2.0 contains 3 portions (core, Level 1, Level 2)

– ODBC 3.0 introduce more functions and supporting for

Unicode

SQL Call-Level Interfaces cont.

SQL Middleware: API

Page 24: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

• Most tool combine both methods

• Visual tools are available

– Delphi (PASCAL variant)

– PowerBuilder (C++ variant)

– Visual Basic (BASIC variant)

Combination and ToolsSQL Middleware: API

Page 25: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

Database Servers

• Receive request from clients

– mixing between standard SQL and proprietary

SQL (to enhance performance)

• Process the request

– create, retrieve, modify, calculate

– containing protection for sharing data

• Send the result back

Page 26: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

• Process-per-client architectures: servers build o

ne process for one client

• Multithreaded architectures: use the concept of

multithread instead of multiprocess

• Hybrid architectures: combination of both archite

cture

Database Server ArchitectureDatabase Servers

Page 27: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

Each user has there own process

Process-Per-Client ArchitecturesDatabase Servers: Database Server Architecture

Page 28: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

• Each client has its own environment space

– one process dead, other can still work

• Good for multiprocessor system

• Consume more resource

– more memory and CPU resources

– slow due to process context switches and inte

rprocess communications

• Examples: Informix, Oracle

Process-Per-Client Architectures cont.

Database Servers: Database Server Architecture

Page 29: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

Sharing same environment space by using the

concept of multithread for multitask

Multithreaded ArchitecturesDatabase Servers: Database Server Architecture

Page 30: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

• best performance because of running on

the same environment address

• not rely much on the OS multitasking: cross-platform applications

• save memory and CPU resources

• one connection down the other gone

• Example: MS SQL Server

Multithreaded Architecture cont.

Database Servers: Database Server Architecture

Page 31: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

• combination of previous two

Hybrid ArchitecturesDatabase Servers: Database Server Architecture

Page 32: Kittiphan Techakittiroj (21/10/58 13:33 น. 21/10/58 13:33 น. 21/10/58 13:33 น.) Database Servers Kittiphan Techakittiroj engktc@au.ac.th

Kittiphan Techakittiroj (20 . . 2566เม ย )

Reference Books

Client/server survival guide 3rd edition by Robert Orf

ali, Dan Harkey, Jeri Edwards (John Wiley & Son

s: 1999)