صفحه 1:
Chapter ©: @pphouiod Oeviqa aad
Orvebpwedt
صفحه 2:
+ Chapter ©: ®pptowiva Desiqa aad Develbpwrdt
Ose IerPaces unl Pooks
Web ‘hiterPares © Dukixers
Web سل
Gervets ond IGP
یط( ما ملظ
ص۱۳
SQL و له
Opptcatcs Geruriy
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE, سا0 لح 0 لا سواه 1 وه
صفحه 3:
00 اه +
© Oost dotcbuse users بت ول a query hong the GGL.
© Corns
© Oct cdots torts (see Charter (12)
© Oo ttierharrs ov Webbed
۲ @ectend (Deb server) wee such techukxier a
© dat sere
© han Gerver Pxes (IGP)
© Cche Gener Pres (BGP)
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE, سا0 لح 0 لا سواه 1 وه
صفحه 4:
Wee Oorld Ode Orb
© Ve Orb is 0 distributed inPorwativa systew bused va hyperient.
Bl Went Deb dornveds ore hypertent doranvedts Porwated via he “Wyper Dent
Darke Loranne (POL)
BWP OL یی مد
© text dloey wil Poot speciPicaivas, ocd oer Porcvutiory test urticces
© hupertedt bobs to her doves, whick coc be associated wih regivas oP the
text.
© Pores, eoobhey users to cuter data whick con thea be seat back to the Deb
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE, ee ©Sbervehnts, Cork ced Cnakershe
صفحه 5:
Porcodied repori
Acme Supply Company, Inc.
Quarterly Sales Report
Sales ‘Subtotal
1,000,000
500,000
1,500,000
200,000
400,000
| 600,000
Total Sales 2,100,000
Period: Jan. 1 to March 31, 2005
Region | Category
North Computer Hardware
Computer Software
All categories
| South Computer Hardware
| Computer Software
__ All categories
اطغ gS ODE: 58
صفحه 6:
دی( ن سب رای( +
Ohp toterPuce databoses to the Deb?
(0 Deb browsers have beoowe the de-Ponte stocdacd user toterPace to لول
© سوه مس اولح و ی و امه مها لب
© Quod the ceed Por مامص لعل صاسي حك spevtiized rode, ute provickrs
pod qraphicd user toterPac
© Grenopies: backs, vidoe urd rect cor reservoices, waiversiy curse
reysiroizg cod gradag, oc 57 oc.
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE,
صفحه 7:
+ Qeb IeterPaves to Datos (Onu.)
©. Opeenic yeveratica oP doranvects
© bicviaices oF staic WP OL domunecis
7 سول custowize Pred Deb domvects Por وی الط
Preble watic عمج لد( ول صا especidiy ۵ بات Deb
bares سول سا
۶ Cokin: Beverae Deb donnvedts dyecnicdly اوه مد مس
.سعساد ول
٠ 005 ول the deploy based oo user موه وتا he database.
~ €.x, talored ads, talored wether od lool بوسجد ...
۱ Displayed tePorcwaticg te up-to-date, uote the static Deb payee
Cox. stock warket icPorwation, ..
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE, en ©Sbervehnts, Cork ced Cnakershe
صفحه 8:
+ OwPorw Resowves boodprs
tobe Deb, Pucetoadiy of portions i provided by Deora وا مها
(Oe).
BORD exnrple:
۰ حاموحا-جاك |عامججا حصامص أمدوت. عحله ل دجا دم
© Dhe Pirst port tehirtes how the domnvedi i 7 be woessed
» Ship” tercicates that the domed ts to be accessed usiey the Wyper Dent
)امه
© Dhe seoved port ques the usique cawe oP a warhiur vo the Totercet.
© Dhe rest of the ORD ideciPies the domed wikia the wachior.
© Vb bod idewiPivativg core be:
۱ (۳ عض رام با من تا هن سم اس
١ @atdeutier (pak aa) of a prounnn, phe لین با نا موم
the progr
~ Coy. hip www .qorde.cocl search ?q=stberschatz
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE, سا0 لح 0 لا سواه 1 وه
صفحه 9:
WTO مه ۷
BWP OL proves ره hypertend bok, ood ivage display Peukwes.
BWP Ob ube proves opt Petes
* Gelert Prow o set of ماو
- Pop-up wens, radi butoos, check bet
+ لس وت
- Text boxes
© Piled to taput seat back to the server, to be ated upoo by oc exevutoble of
te server
۱ WyperText MrowPer Procol (PPC) used Por coerunicativg wits the
Orb server
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE, سا0 لح 0 لا سواه 1 هه
صفحه 10:
+ CGuvple VWTOL Gowve Text
<hiwl> <boy>
Stable border mks = O>
Sir> <i> B-CD1 </i> <td> Drweirua </td> <> GOD </td> </i>
>
< هلک موی < کامجممه<ن> ۳ <veder>
< لاس ترس ةا) "تممص ممونا>
جاک ای جات له وچمه Gelert
<selent رحس <
> یه سل sekrted> rvrnt
> مس راکسلس < bows
حاموابو|>
راکو تسه مسر نو>
Stopul ype=subcat voke="subat">
<Porn>
<body> </hicol>
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE, سا0 لح 0 لا سواه 1 همه
صفحه 11:
ODODE, ,8 0 مس 0۸ و0 م6 بیط
صفحه 12:
+ بسن Orde Ooriptaq aad @ppbts
۲ مس oon Prick )موه مه serps) موب dens wits
لو بط mera he pct one the dct rte
۶ حول
۱ Shockwave Por cxicratoal sees
© OROL
© Ope
© Cleutside seripelprcunnns dow doves to be oie
۶ وا مش رو executes و ol the bad site
© Cy, ewewe tot vokes cured by were sutshy sowe اجات دومص صمت
© Pera Plexble toterontioa wik the user.
* Gxevutey proqrans of the cheat site speeds رو طلست بو مه و
rowed trips iy server
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE, سا0 لح 0 لا سواه 1 موه
صفحه 13:
+ Oboc Orde Goriptay wad Oevurty
© Geowip wechuisws weeded ty eesure thot wolvious suripts do wl roe
deczage ty the cheat wachice
© Gosy Por kevted copdblliy scriptog lacuacges, harder Por yecerd purpose
سس مسا recuaces the dev
Bx. hvo's sen ny systiew exoures thot he lava appt onde does oot archer
xxv systew ote deol
© Osdlaws dosgervus actives suck us Pie writes
© OoiPes the wer vbout potccidly deagerous unioes, ed due the optics i
bor! the prograny pr to اج وه
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE, هوه
صفحه 14:
Web Gervers
BO Web server owe cued) serve os a Prot eod too verity oP Portion
رد
BO ODhe dornvedt one fg ORL رو عومجم مه رل بو
wheo ree, yecerdes a WL TOL doagrest.
© Ohea a WDC server reveves و request Por suck a domnved, 8
روم | مور ued seuds back the WPL dorccect that
لساك كر
© Dhe Web ctedt cos poss extra orqevedts wits the ome oP the dornvect.
Bo wekd a cew senice oo he Deb, vor skp) ceeds ty orcs ood teeta ot
© Dhe Deb browser provides yrophicdd wer ioterPare ty the iPorctic
serine.
8 0 Cateway IoterPare (O61): a tard Pace betwers web cred
اوه server
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE, ene ©Sbervehnts, Cork ced Cnakershe
صفحه 15:
web server
(application server)
database server
browser
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE, سا0 لح 0 لا سواه 1 هوه
صفحه 16:
+ Two-Der Osb Oroktieotre
19 Duties levels oP teicerioa hove pverkeuds
ا orchterkwe
web server and
application server
(Matabase server)
browser data Ss
server
صفحه 17:
+ 1۳۵ aad یهت
روما اس ل ۱ ۱
۱۳۹۹ ove he server replies too request, the server closes the
سا لب وی cleat, ood Porgets ol about the request
ای وله عشووویی 0090/0000 لو رها مه( رس و ۶
مس ماه the ات
* صوص ود مدر cukeuicaicg ced تاه اه
۱ مه reduces load vo server
* operation systecs have tight bevis oo cucober oF و و ای ون
wacker
111 1 مدق وذلد services ماوت موه له
© @.y. wer cubeuicuiva shoud be door poly voor per sessiva
© Gohiivd: we a oovhie
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE, ew ©Sbervehnts, Cork ced Cnakershe
صفحه 18:
+ 55-225 Cocke
۳ cook eo eordd piece of eat crctoicion ecient Rr
۶ مس ام ما وچمه بای
© ect by browser to he ا
> pat ok ke WPDR proecol
© Gener saves KPornmdion chou cokes temved, ood oo use fhe
SEY S requEDt
مود هورق on wer لودجم
۲ ول ram be stored رام or Por a heed tore
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE, سا0 لح 0 لا سواه 1 موه
صفحه 19:
Gerviets
18 وا متسه نموه مرول oa (BP Por مرا موی the Det
موم موه له سود
۶ جا لمج لس مور بت ون ی و ood POD tent back to chest
BQ ppkecion prounny (dor caked «ser vet) te baded ist he Deb server
© Peter wordt
© Chk نموه سوم 9 ew threw is he Deb server
۱ thread جا cbsed coor he request ie serviced
19 Genet OP provides u eSevsien() لطاب
© Gets وت لت تم وا من او و ood user ito deuiPy sessivd
a Panther ام
© Provides wetheds to store ond look-up per-sessivg Portion
* G.x. wer cenve, prePerewes, ..
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE, سا0 لح 0 لا سواه 1 موه
صفحه 20:
+ @xaope Opriet Ode
abi chess @ackGuery(Gervlt extends WtpSer tet {
ribo void dABe(WipGervi(Request request, ip Serde(Respree revi)
throws GendtPxrepion, (OPmepion {
Grin ioe )مها سس
)تا مسج < امه من (
... ول موجه جوا سا لا 9 لو .
مج راون جما جا لوه صن با موجه چد..
rent. Ordtedt Pipe (“exthie!");
PrickDrter ra = remdice(Drier( );
rntiprictha("<LEBO>< PLE Query Remds/PIPLE></LECBO>’);
;)"> وت vay
boar); + "=" + یی + بر + کمن سل( )ی
prvaka(“</BOOY'>");
whose ( );
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE, سا0 لح 0 لا سواه 1 موه
صفحه 21:
+ مسب Corgi
© Gerverside soriptoy stopifies he task of ری a database to he Deb
© Oebce o WO dood wil ewhedded exeruttble vode(GGL queries.
© dapat vdues Pro WP ODL Pores coo be ved dreviy to the ewbedded
۵0اه queries.
© Okea the doanvedi b requested, the Deb server exenies the ewbedded
oodelGQDL queries to yeoercte the uted WPOL حول
© Onno server-side soriptory kee
© NGO, Gerverside devesrript, Ork(Pusica Dorbup Locguaee (cP),
PLO, dscript
© Geverd purpose soripteny krenpages: OGoript, Pent, Pyboo
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE, سا0 لح 0 لا سواه 1 موه
صفحه 22:
+ Thopraven (Deb Garver. Par Purcnnoe
© PerPorwore te ot iseur Por popu Deb stew
© Ow be worssed by wives oP users every thy, thousunds of requests
per secoed of probs te
۲ اون techoiques used to reduce vst of servieg powes ارو بو
co wowties beter requests
© ۵ ۳ و sie?
١ عمج موه ها یی 0000ل خام باون
۱
~ Ourked resus cust be updated ۳ اه ال رای
* Carkieg oP gecerated TOL
© Othe chea's اس
۱ Cackiay oF pages by Deb pron
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE, سا0 لح 0 لا سواه 1 موه
صفحه 23:
Trierers
BO piney سا روا ره لهج ما ماه د حا syste os 0 side
ABest a ریاس he debe
© Vo design 9 riper wero, we oust!
© Gpevky the ooudiiogs vader whick the trcger is to be exeruied.
© Gpeky the antoes te be toed whe the trigger execs.
© Prigers و لد GGL stradard is GQL:dO99, but supported evet
ال او بر مرو لصو ری اور
سا0 لح 0 لا سواه 1 موه ODODE, ,8 0 مس 0۸ و0 م6 بیط
صفحه 24:
riqer Cxawele
۲ یت bot ketead of dla win cecpiive uszmnt bosoms, the backs cooks wks
با له
۱
the overdroht اه مه ع وا واه ملس ©
۱ Meuicd tp the arco ocober oF the
امه سوه
۲ 1 ما میت سا ما صولی بنج ما سا وش و لت trot
ی لا مقر و وا ور
سا0 لح 0 لا سواه 1 موه ODODE, ,8 0 مس 0۸ و0 م6 بیط
صفحه 25:
0( 0 مب +
امحححه من سلج سوك صبرت سره روا ور
ننج جد rePereurtey ww rw
Por pack row
whee or. bukrae < D
هریت
سا ها بو
اج موه |
سوط مج
DO = سا او مت طلی
anwar وت ]
سا0 لح 0 لا سواه 1 موه ODODE, ,8 0 مس 0۸ و0 م6 بیط
صفحه 26:
+ Prieertay Gueds werd Oviow in SQL
۱ مه مه و tesert, delete or upd
BD renere oo update coc be resitcted tp اه وه
© Oy. crete tegen verdPririner ام مسلط ی
BE Ockes of otrbutes bearer ond Pier oc pds oat be rePerecred
© eR erect od row ae: Por deter ord upd
© جد بدح يواجر we! Por Keer onl verkies
BOP ekners coc be ontvated bePore oo eved, whick coo serve us extra .جام تجممه
ی وا لا همه بط
سا0 لح 0 لا سواه 1 موه ODODE, ,8 0 مس 0۸ و0 م6 بیط
صفحه 27:
+ (Granted Level Prigers
tested of مت وه و رس لاه ای و میت وه هوجو oot
be exeruted Por dll و و روا لهچ
سا لس موه وج( Ose ©
© Ose rePereckny ch bbe or rePerectoq ew thle refer ما
tewoporan tibles (riled irocstiow tables) orotate the oPPevied rouse
۶ Conbe wore ef Aveo wheo dedioy wits OGD stateweuts tot update ot force
اس oP rows
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE, سا0 لح 0 لا سواه 1 جوو
صفحه 28:
+ @xterad Dork! ®vicw
Be sowetkes require اه ات ای ty be رز 7a a database update:
© Gig. reorderieg oo tew whose quonily ino warehouse has bere seal, or
ماه من رد light,
۲ ی مر be used to dreviy موجه او asics, BOT
© Driqgers cos be used ty record uniives~e-be-toked foo separcie table
© Woe oo extercd proves tot repeuedy svocr the tuble, caries اوه له
world ومصاصه ocd deletes action Pro tbl
BG, Gappoee cwarcknee her he Polen ble
(ew, kvet): Wow cack oF pack tow te rhe worker رمرم
bevel of pack tw لوط موی coribvel (tew, kvel) 2 Dkot ts the
reorder (ew, coud): heat quaxtiy shod we re-order of kere
orbs (jew, orev) 2 Orders ty be ped (read by exterad proces)
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE, سا0 لح 0 لا سواه 1 موه
صفحه 29:
@xerad 00۱ مت (Ovu.)
مه مه تم و لاه رطس وبا و
سس و تور تشه ننجت جع تور له وج وی
Por ewhk row
ere eed = welch evel
Prow wick!
ray = ey cus eee) اس مجان
eden eres)
Brow wrkvel
( سب مسبت وا
جحاسج هلا لوص
(peed te, cert
where reorchr.iew = orow.ew)
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE, سا0 لح 0 لا سواه 1 موه
صفحه 30:
ممه
:00 ,© بج Btn, +9 - سپ م6 سیون
صفحه 31:
+ Oko Ort To Doe Trigers
© OPrqgers were weed eorter Por techs suck os
© erection saree chia (e.. tt روت of each deportes)
© Reploutan detcbases by revorden chores ty spent rekiiocs (coiled
chaage or debe rebsiocs) او ما موس موه مها اجه the
المج د جو مور سوج عجر
© Vhere ore better ways of dota these اس
۶ وله له provide bull te wotertized view ی و تا(
موم tak
۱ ما ۲ مه خش سس لیب(
۲ موی( Poviiies cod be used tasteud oF iqgers io wan cose
© OeRae wethods ty update لا
© وت نی بو us port oP the update wethods tostead of
through مج د
سا0 لح 0 لا سواه 1 موه ODODE, ,8 0 مس 0۸ و0 م6 بیط
صفحه 32:
+ مت سس 00 با مسق P.8)
ones of cukorizaica vo ports oP the database
ead cuhortzeton - lows ready, but oot woedPicaiivg oP deta.
Sheert suhortzdivs ~ lows اه مج oe deta, but oot رصم اه لت chat.
Opddte cuhortrdivs - lows wodPicaiva, but oot ال ان متا
ناه - یی ولو( deletion oP dot
ODODE, ,8 0 مس 0۸ و0 م6 بیط
صفحه 33:
+ هس (Oow.)
(ones of وال سا رل وا مان escheat:
ان متا له مه ماه - لاله طلی terhces.
.ماع و و اش تن متا lows occa or = موه مج
۱
:
۲ Resouces وله - chow oreuivs of caw rebsices.
۰
ل
موه
ODODE, ,8 0 مس 0۸ و0 م6 بیط
صفحه 34:
+ 9 ای یگ Obata
© Osers coo be queu cuborizaive oo views, wikout betay vec coy متنجوانه
wo the rebiicas used tothe views ماوت
Bl bly of views 7 hide daa serves bob to skoplBy usage of the eyotecr مالم
موه مر by dow isn weer acces ool) to ot fey ceed Bor bei جام
۲ لفات میتی sevuniy ood viewslevel securiy cod be used to
kot user's ures ty precisely the dott tot user ceeds.
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE, سا0 لح 0 لا سواه 1 موه
صفحه 35:
تا سل +
۱ to hoo the ones oF the nsiowers oP ruck
broack, but is wt ما متسه بو وا وان Porat.
© @pprowk: Orc revi weess ty he boo rebtion, but yract acess to the
view mustzad, whick و رای وه the ones oF mstowers od the
brawhes of whick they hove o boos.
© Dhe ولمم view te dePioed ic GGL us سا
rede vew جه جمحاأ-اصج
ی لت ne
Pow boraeer, boo
او ماما < جاوما جوا وان
سا0 لح 0 لا سواه 1 موه ODODE, ,8 0 مس 0۸ و0 م6 بیط
صفحه 36:
Oww Oxrople (Ovu.)
© OV he clerk te cuhorized to oer the result oP the query:
geet *
هه مس(
تا امه ع 00 processor trowshiter the result tooo query روصم با میا( ۲
و لوصو مه مهو و itike dotcbose, we obto
مت clerk's query bePore query لا من لین با ی ی( لا
view. اجه مت جلا زرا بنجب د ارو
سا0 لح 0 لا سواه 1 موه ODODE, ,8 0 مس 0۸ و0 م6 بیط
صفحه 37:
+ Crdortrtre va Owe
جا سداد red من وت منت مور Orecion oP view does ot require ©
او رما
۲ و هه و با voy hose privleyes tot provide um oddtiocad
شمه beyood thot he را bed.
18 G.y. P oredr oP view nestor kad voy read cuborizaiva oo borrawer ord
bow, ke vets voly read cuhortzaiog vo custo
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE, eer ©Sbervehnts, Cork ced Cnakershe
صفحه 38:
+ Orextoq oP Preps
(Dhe posse oP ما تایه coe user to corer way be represroted by
“Whe codes of his cropk ure he were.
“Phe root of he raph te he dotcbose وله
باون انیس و وس 0
O,> O, rkoues tt wer O, kas qrocted ure ouhortzctica oa bro 7 وله وه
0
™
1
U,
ی تایه و
00
0
DBA
U;
Cin, Pr, 8008, +9 - سپ م6 سیون
صفحه 39:
Gres زمظ) وی رسد و)
© Requrewed. (Bl edges to oo تمه graph west be port oF sve pot
pricey wits the database udtinistcatar
BE OBO revokes wren Prow Dy:
© Grn cast be revoked Prine OD, ste 0 oo bane موه
© لامج سا ببس تم Prow O,, stare OD, kes eeher ماه
Fron OOO trrank O,
۲ خإن مرو و تا gris wik ow pas Proc he root
۰ ۵69 فقو مب ۲ 0
* له مب 9 0
© Og arnt متفه 0
© OBO revokes wubortztion Prow 0,
Beet revoke art O,, O, ord Pro و( O,, owe here to pak Prow
08 ۰ و ۵ ب(
سا0 لح 0 لا سواه 1 موه ODODE, ,8 0 مس 0۸ و0 م6 بیط
صفحه 40:
+ Ovowty OpeoP ۰ ب96)
۱ حا ل اه ل tere eed ener tec
rad Sprivicce ها
pa Srehiica cenme or view uKK7e> t7 Ser bet>
نا <wer bP is!
۶ یه
5 الت ا 32 222 لفك ال للك مدا و
Gre Gare athe beer),
© Groctoy 3 prideye vo view does وه ری راو بو privieyes oa the
اه رال
۱
(or be له اد (
سا0 لح 0 لا سواه 1 مهو ODODE, ,8 0 مس 0۸ و0 م6 بیط
صفحه 41:
rules is OGD
Beebe dows red woev to rekatoor te obi ty suey woken her view
© Orxvpke: grt were Oy, Da, oer O,, weer مالسا سا من متفه
godt rebel va brink te Dy Dp, Do
ای بت نا رانا سا بو
pdt! the توبات tor urdate wetay the OGL update stata
debe: be chit to delete رید
ها io decker Puree hove wher orate رواب :وی
ما انس a wer ty ver a وی 066 ۰ وی
مار اما سا تن تمهاد دنع ات ایوگ
سا0 لح 0 لا سواه 1 ومو ODODE, ,8 0 مس 0۸ و0 م6 بیط
صفحه 42:
+ Credew~ To rad سب
atk yeu option: glows a user who fs yroated u privieye to poss the privilege vo
to her users.
© تسم
rent sel vo brooch 0, wi grat opto
sues Oy he weber piulees on broach ond dws مب وان( his
proce to vers
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE, سا0 لح 0 لا سواه 1 موه
صفحه 43:
Ros
۲ او pers coord privieyes Por a chiss oP users cos be spevitied pet vor by
“roe” رسمه و ما
۲ rideyes con be graded ty or revoked Prow roles, just the wer
Qotes coc be usstqaed ty users, ood eved ty her roles
جام سوه 1999 :را B
rede role جات
rede role worn
ret sect oa brinch to tbr
grant update (bokure) pa corre ty tele
0 te URRY
ری اعد نمی
rant ler ty olce, bob
ret our و wt
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE,
صفحه 44:
+ متفه متام a OGL
موه سور وا لت مه Bl Phe revoke
revoke sprivicce b>
Fee ae ete بر ب tree Sorc ere سار erate
۲ Gacrnople:
revoke seboi oa brork Prow Dy, Do, OD cone
© Revocuive of 0 priviege Prow 0 user way cow other users ubv ty lose thot
لا ماس ۲ us اه بلس he revoke.
Bl Qe ee preven cook by sper ani revit!
revoke select oa broach Frou Dy Da, ار(
(tk revinet, the revoke coward Pais Po cascade revokes ore required.
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE, سا0 لح 0 لا سواه 1 موو
صفحه 45:
+ Revoliay Bukortzdios ta OGL (Ova)
11 <prideyestet> way be dite revohe oll prideyes the revoher way bold.
۲ 1 > ای publo oll users lose he privieye except those gravid it
.لصاوي
18 118 وت عون ارم وی دولا twice to the sue user by dPPered yruices,
the wer way netic the privilege oPter the امس
© Ol prvieges thot depeud oo the prulege betay revoked ure osv revoked.
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE, سا0 لح 0 لا سواه 1 موه
صفحه 46:
+ Lioktiow oP OQ) @ukortraioa
0 وف هی مود بت سید pk evel
9 revit okey iy see ody (he Rapke otprie) her ou grees
BH Othe gris Deb wore ty dicey, dhtcbore urceeees oor primary Prow
وه ابو
۶ Bod were dot have dotebore wer tds, hey one ol wapped to ther saure database wer
0
1 0۱ سوت of تفای نی (ok wo web opphotion) amy be warped ty 3 oka
جيف لول
ارو ta dbove pwey Pally on he opphouiva progr, wile موی نان سا
Brow QL
را لامرن tuples, ou be تمه نا graced aubortrumcey, suck a ولا تا ©
ای سا
۱ ke epphouioa code, ced way be depersed ol
ver ex طابر
© Ohechiey Por cbeewre of auhortratva bophoks becowes very UPPioul stare ۱ و
reactor harge cemmuety oP apphectiza code
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE, سا0 لح 0 لا سواه 1 موه
صفحه 47:
Our Trab
Qo ceri tral is a loy of oll choages (tuserisideletes/urdates) to the dotabuse day uth:
سوه و os which user perPorwed the chooye, aed whoo he choo wor
perPorwed.
© Osed to rack erocers!Prouduedt updates.
© Oca be nope weded usiey riggers, but woo dotdvose systews provide direct
support.
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE, سا0 لح 0 لا سواه 1 جهو
صفحه 48:
+ Bpplocicn Gerry
هزم ول عم موی سول Occ woy be curried whe ©
او اسان
۲ ومیل اه م۳ techoique:
© Rebtivel) وله ۳ موه were .دمل مج له مضه وا
۱ sevreny of the oeoriher but 7a the
secrecy سل اه سم هط oiled the eorrppicd hep.
© Cxirewely dPPicdk Por oo toiarder to detercotue the eurrypiva hey.
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE, سا0 لح 0 لا سواه 1 موه
صفحه 49:
+ @umpta (Ova)
Bax Beeryars Onxnckrd (DOO) ovbointes chorwters onl rearranges ter order oa the
brew oP ow puoi key whek ty proved wy adhortzed were uxt a seo re wevkentex.
chew ty eo wore seve thot the hey reweeiva weckenie stare the key bee ty be
اجان
۵ لوا اجه ,0۵۵) پجا له تنم و با (0۵) تا مرت اه vs
fe Ricked corte, butts obo depeudeut va shared secret hove
Bl Ohlenhey coer ptoaty baed oa wack wer hear how hey!
© ble hey — pibloly prbleohed hey wed iy peor dota, but cue be weed to decrypt
skis
8 pre لت بجی الط ۵ بای متا وا - رو weed to ص مجح
۳ 7 dean) exer ia,
] sokewe ty sunk tut tty kopowbke or extra hard to decrypt chia quea ool her
با ال
Phe ROO pble-hey everyytva shew b bwsed ox the harkens of Paotarny avery
kare onnrber (DO's oP cee) io to pri وروی
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE,
صفحه 50:
مشش ) +
۲ osswerd based cuheotcaivg is widely used, but is susceptible to su موم
سس
و
و وه بط qecercied) طلسم وله 0۵ ۶
لجس و لو و exerts جو( ©
اج ,هروس بو رفس 08 ۶
© اوه موی و له 2 زوا موه موه تالم ص ول
stay user's public hey, ood user decrypt od seaday he wessage back
Ont skmotues oe used to ver Py ول اه ره
© Cag ee print bey (oreverse) مه موه له رل مرت وا ver Py
تایه by eke pubkr hep (ja reverse) tp decrypt chia. Ody hokey oP
ترجه سا لته جروج لو روا رم
© Oni okentures dev help ewe woepudaion! sender
pane hier chico to have wt rected the cht
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE, سا0 لح 0 لا سواه 1 موه
صفحه 51:
Qrgid OcriPicdes
BO tgtd verPoues we used ty verPy cubeutcay oP جوا اج
robles: whe pou cow wunicdte wih a web ste, how de you تنج PF you ore باه
۱ (لجاوموصا جد عن صاد جاعبب
اه پات سا تاه روا ال صا صف :دمشام©) ©
تجح نا روا الم ع خلا بكلامجب صا نبحها :مصاتاصسرة) ©
مسب لا
© Gren olest (ex. browser) hue puble keys oo Pew retlevel veriPicaios
مسب
:رسای مه و توا لح بو ام لت )اتب من عد و ۶
عد صم ه ای ها مج امد
© Cleat coc use public hey of certPicaica cuhorip to ی رخا
© Outiple eve’ oP veriPicaive cuhorites vac exist. (Bock veriPicatios cuboriy
١ كدوم tis owe public-key ی siqued by
Kroker level cuhoriy, ocd
” Oses tts privote hey to stot the certPicate oP vier web sites/auhorties
Derdewr Ojetre Orcwp- O* Cire, Oi 8, ODODE, سا0 لح 0 لا سواه 1 موه
صفحه 52:
Gad oP Okaper
Chapter 8: Application Design and
Development
Database System Concepts
©Silberschatz, Korth and Sudarshan
See www.db-book.com for conditions on re-use
Database System Concepts
©Silberschatz, Korth and Sudarshan
Chapter 8: Application Design and Development
User Interfaces and Tools
Web Interfaces to Databases
Web Fundamentals
Servlets and JSP
Building Large Web Applications
Triggers
Authorization in SQL
Application Security
Database System Concepts - 5th Edition, Aug 9, 2005.
8.2
©Silberschatz, Korth and Sudarshan
User Interfaces and Tools
Most database users do not use a query language like SQL.
Forms
Graphical user interfaces
Report generators
Data analysis tools (see Chapter 18)
Many interfaces are Web-based
Back-end (Web server) uses such technologies as
Java servlets
Java Server Pages (JSP)
Active Server Pages (ASP)
Database System Concepts - 5th Edition, Aug 9, 2005.
8.3
©Silberschatz, Korth and Sudarshan
The World Wide Web
The Web is a distributed information system based on hypertext.
Most Web documents are hypertext documents formatted via the HyperText
Markup Language (HTML)
HTML documents contain
text along with font specifications, and other formatting instructions
hypertext links to other documents, which can be associated with regions of the
text.
forms, enabling users to enter data which can then be sent back to the Web
server
Database System Concepts - 5th Edition, Aug 9, 2005.
8.4
©Silberschatz, Korth and Sudarshan
A formatted report
Database System Concepts - 5th Edition, Aug 9, 2005.
8.5
©Silberschatz, Korth and Sudarshan
Web Interfaces to Databases
Why interface databases to the Web?
1.
Web browsers have become the de-facto standard user interface to databases
Enable large numbers of users to access databases from anywhere
Avoid the need for downloading/installing specialized code, while providing a
good graphical user interface
Examples: banks, airline and rental car reservations, university course
registration and grading, an so on.
Database System Concepts - 5th Edition, Aug 9, 2005.
8.6
©Silberschatz, Korth and Sudarshan
Web Interfaces to Database (Cont.)
2. Dynamic generation of documents
Limitations of static HTML documents
Cannot customize fixed Web documents for individual users.
Problematic to update Web documents, especially if multiple Web
documents replicate data.
Solution: Generate Web documents dynamically from data stored in a
database.
Can tailor the display based on user information stored in the database.
– E.g. tailored ads, tailored weather and local news, …
Displayed information is up-to-date, unlike the static Web pages
– E.g. stock market information, ..
Database System Concepts - 5th Edition, Aug 9, 2005.
8.7
©Silberschatz, Korth and Sudarshan
Uniform Resources Locators
In the Web, functionality of pointers is provided by Uniform Resource Locators
(URLs).
URL example:
http://www.bell-labs.com/topics/book/db-book
The first part indicates how the document is to be accessed
“http” indicates that the document is to be accessed using the Hyper Text
Transfer Protocol.
The second part gives the unique name of a machine on the Internet.
The rest of the URL identifies the document within the machine.
The local identification can be:
The path name of a file on the machine, or
An identifier (path name) of a program, plus arguments to be passed to
the program
– E.g. http://www.google.com/search?q=silberschatz
Database System Concepts - 5th Edition, Aug 9, 2005.
8.8
©Silberschatz, Korth and Sudarshan
HTML and HTTP
HTML provides formatting, hypertext link, and image display features.
HTML also provides input features
Select from a set of options
– Pop-up menus, radio buttons, check lists
Enter values
– Text boxes
Filled in input sent back to the server, to be acted upon by an executable at
the server
HyperText Transfer Protocol (HTTP) used for communication with the
Web server
Database System Concepts - 5th Edition, Aug 9, 2005.
8.9
©Silberschatz, Korth and Sudarshan
Sample HTML Source Text
<html> <body>
<table border cols = 3>
<tr> <td> A-101 </td> <td> Downtown </td> <td> 500 </td> </tr>
…
</table>
<center> The <i>account</i> relation </center>
<form action=“BankQuery” method=get>
Select account/loan and enter number <br>
<select name=“type”>
<option value=“account” selected> Account
<option> value=“Loan”>
Loan
</select>
<input type=text size=5 name=“number”>
<input type=submit value=“submit”>
</form>
</body> </html>
Database System Concepts - 5th Edition, Aug 9, 2005.
8.10
©Silberschatz, Korth and Sudarshan
Display of Sample HTML Source
Database System Concepts - 5th Edition, Aug 9, 2005.
8.11
©Silberschatz, Korth and Sudarshan
Client Side Scripting and Applets
Browsers can fetch certain scripts (client-side scripts) or programs along with
documents, and execute them in “safe mode” at the client site
Javascript
Macromedia Flash and Shockwave for animation/games
VRML
Applets
Client-side scripts/programs allow documents to be active
E.g., animation by executing programs at the local site
E.g. ensure that values entered by users satisfy some correctness checks
Permit flexible interaction with the user.
Executing programs at the client site speeds up interaction by avoiding many
round trips to server
Database System Concepts - 5th Edition, Aug 9, 2005.
8.12
©Silberschatz, Korth and Sudarshan
Client Side Scripting and Security
Security mechanisms needed to ensure that malicious scripts do not cause
damage to the client machine
Easy for limited capability scripting languages, harder for general purpose
programming languages like Java
E.g. Java’s security system ensures that the Java applet code does not make
any system calls directly
Disallows dangerous actions such as file writes
Notifies the user about potentially dangerous actions, and allows the option to
abort the program or to continue execution.
Database System Concepts - 5th Edition, Aug 9, 2005.
8.13
©Silberschatz, Korth and Sudarshan
Web Servers
A Web server can easily serve as a front end to a variety of information
services.
The document name in a URL may identify an executable program, that,
when run, generates a HTML document.
When a HTTP server receives a request for such a document, it
executes the program, and sends back the HTML document that is
generated.
The Web client can pass extra arguments with the name of the document.
To install a new service on the Web, one simply needs to create and install an
executable that provides that service.
The Web browser provides a graphical user interface to the information
service.
Common Gateway Interface (CGI): a standard interface between web and
application server
Database System Concepts - 5th Edition, Aug 9, 2005.
8.14
©Silberschatz, Korth and Sudarshan
Three-Tier Web Architecture
Database System Concepts - 5th Edition, Aug 9, 2005.
8.15
©Silberschatz, Korth and Sudarshan
Two-Tier Web Architecture
Multiple levels of indirection have overheads
Alternative: two-tier architecture
Database System Concepts - 5th Edition, Aug 9, 2005.
8.16
©Silberschatz, Korth and Sudarshan
HTTP and Sessions
The HTTP protocol is connectionless
That is, once the server replies to a request, the server closes the
connection with the client, and forgets all about the request
In contrast, Unix logins, and JDBC/ODBC connections stay connected
until the client disconnects
Motivation: reduces load on server
operating systems have tight limits on number of open connections on a
machine
Information services need session information
retaining user authentication and other information
E.g. user authentication should be done only once per session
Solution: use a cookie
Database System Concepts - 5th Edition, Aug 9, 2005.
8.17
©Silberschatz, Korth and Sudarshan
Sessions and Cookies
A cookie is a small piece of text containing identifying information
Sent by server to browser on first interaction
Sent by browser to the server that created the cookie on further interactions
Server saves information about cookies it issued, and can use it when
serving a request
part of the HTTP protocol
E.g., authentication information, and user preferences
Cookies can be stored permanently or for a limited time
Database System Concepts - 5th Edition, Aug 9, 2005.
8.18
©Silberschatz, Korth and Sudarshan
Servlets
Java Servlet specification defines an API for communication between the Web
server and application program
E.g. methods to get parameter values and to send HTML text back to client
Application program (also called a servlet) is loaded into the Web server
Two-tier model
Each request spawns a new thread in the Web server
thread is closed once the request is serviced
Servlet API provides a getSession() method
Sets a cookie on first interaction with browser, and uses it to identify session
on further interactions
Provides methods to store and look-up per-session information
E.g. user name, preferences, ..
Database System Concepts - 5th Edition, Aug 9, 2005.
8.19
©Silberschatz, Korth and Sudarshan
Example Servlet Code
Public class BankQuery(Servlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse result)
throws ServletException, IOException {
String type = request.getParameter(“type”);
String number = request.getParameter(“number”);
…code to find the loan amount/account balance …
…using JDBC to communicate with the database..
…we assume the value is stored in the variable balance
}
result.setContentType(“text/html”);
PrintWriter out = result.getWriter( );
out.println(“<HEAD><TITLE>Query Result</TITLE></HEAD>”);
out.println(“<BODY>”);
out.println(“Balance on “ + type + number + “=“ + balance);
out.println(“</BODY>”);
out.close ( );
}
Database System Concepts - 5th Edition, Aug 9, 2005.
8.20
©Silberschatz, Korth and Sudarshan
Server-Side Scripting
Server-side scripting simplifies the task of connecting a database to the Web
Define a HTML document with embedded executable code/SQL queries.
Input values from HTML forms can be used directly in the embedded
code/SQL queries.
When the document is requested, the Web server executes the embedded
code/SQL queries to generate the actual HTML document.
Numerous server-side scripting languages
JSP, Server-side Javascript, ColdFusion Markup Language (cfml),
PHP, Jscript
General purpose scripting languages: VBScript, Perl, Python
Database System Concepts - 5th Edition, Aug 9, 2005.
8.21
©Silberschatz, Korth and Sudarshan
Improving Web Server Performance
Performance is an issue for popular Web sites
May be accessed by millions of users every day, thousands of requests
per second at peak time
Caching techniques used to reduce cost of serving pages by exploiting
commonalities between requests
At the server site:
Caching of JDBC connections between servlet requests
Caching results of database queries
– Cached results must be updated if underlying database changes
Caching of generated HTML
At the client’s network
Caching of pages by Web proxy
Database System Concepts - 5th Edition, Aug 9, 2005.
8.22
©Silberschatz, Korth and Sudarshan
Triggers
A trigger is a statement that is executed automatically by the system as a side
effect of a modification to the database.
To design a trigger mechanism, we must:
Specify the conditions under which the trigger is to be executed.
Specify the actions to be taken when the trigger executes.
Triggers introduced to SQL standard in SQL:1999, but supported even
earlier using non-standard syntax by most databases.
Database System Concepts - 5th Edition, Aug 9, 2005.
8.23
©Silberschatz, Korth and Sudarshan
Trigger Example
Suppose that instead of allowing negative account balances, the bank deals with
overdrafts by
setting the account balance to zero
creating a loan in the amount of the overdraft
giving this loan a loan number identical to the account number of the
overdrawn account
The condition for executing the trigger is an update to the account relation that
results in a negative balance value.
Database System Concepts - 5th Edition, Aug 9, 2005.
8.24
©Silberschatz, Korth and Sudarshan
Trigger Example in SQL:1999
create trigger overdraft-trigger after update on account
referencing new row as nrow
for each row
when nrow.balance < 0
begin atomic
insert into borrower
(select customer-name, account-number
from depositor
where nrow.account-number =
depositor.account-number );
insert into loan values
(n.row.account-number, nrow.branch-name,
– nrow.balance );
update account set balance = 0
where account.account-number = nrow.account-number
end
Database System Concepts - 5th Edition, Aug 9, 2005.
8.25
©Silberschatz, Korth and Sudarshan
Triggering Events and Actions in SQL
Triggering event can be insert, delete or update
Triggers on update can be restricted to specific attributes
E.g. create trigger overdraft-trigger after update of balance on account
Values of attributes before and after an update can be referenced
referencing old row as : for deletes and updates
referencing new row as : for inserts and updates
Triggers can be activated before an event, which can serve as extra constraints.
E.g. convert blanks to null.
create trigger setnull-trigger before update on r
referencing new row as nrow
for each row
when nrow.phone-number = ‘ ‘
set nrow.phone-number = null
Database System Concepts - 5th Edition, Aug 9, 2005.
8.26
©Silberschatz, Korth and Sudarshan
Statement Level Triggers
Instead of executing a separate action for each affected row, a single action can
be executed for all rows affected by a transaction
Use
for each statement
Use referencing old table or referencing new table to refer to
temporary tables (called transition tables) containing the affected rows
Can be more efficient when dealing with SQL statements that update a large
number of rows
Database System Concepts - 5th Edition, Aug 9, 2005.
instead of
8.27
for each row
©Silberschatz, Korth and Sudarshan
External World Actions
We sometimes require external world actions to be triggered on a database update
E.g. re-ordering an item whose quantity in a warehouse has become small, or
turning on an alarm light,
Triggers cannot be used to directly implement external-world actions, BUT
Triggers can be used to record actions-to-be-taken in a separate table
Have an external process that repeatedly scans the table, carries out externalworld actions and deletes action from table
E.g. Suppose a warehouse has the following tables
inventory (item, level ): How much of each item is in the warehouse
minlevel (item, level ) : What is the minimum desired level of each item
reorder (item, amount ): What quantity should we re-order at a time
orders (item, amount ) : Orders to be placed (read by external process)
Database System Concepts - 5th Edition, Aug 9, 2005.
8.28
©Silberschatz, Korth and Sudarshan
External World Actions (Cont.)
create trigger reorder-trigger after update of amount on inventory
referencing old row as orow, new row as nrow
for each row
when nrow.level < = (select level
from minlevel
where minlevel.item = orow.item)
and orow.level > (select level
from minlevel
where minlevel.item = orow.item)
begin
insert into orders
(select item, amount
from reorder
where reorder.item = orow.item)
end
Database System Concepts - 5th Edition, Aug 9, 2005.
8.29
©Silberschatz, Korth and Sudarshan
Triggers in MS-SQLServer Syntax
create trigger overdraft-trigger on account
for update
as
if inserted.balance < 0
begin
insert into borrower
(select customer-name,account-number
from depositor, inserted
where inserted.account-number =
depositor.account-number )
insert into loan values
(inserted.account-number, inserted.branch-name,
– inserted.balance)
update account set balance = 0
from account, inserted
where account.account-number = inserted.account-number
end
Database System Concepts - 5th Edition, Aug 9, 2005.
8.30
©Silberschatz, Korth and Sudarshan
When Not To Use Triggers
Triggers were used earlier for tasks such as
maintaining summary data (e.g. total salary of each department)
Replicating databases by recording changes to special relations (called
change or delta relations) and having a separate process that applies the
changes over to a replica
There are better ways of doing these now:
Databases today provide built in materialized view facilities to maintain
summary data
Databases provide built-in support for replication
Encapsulation facilities can be used instead of triggers in many cases
Define methods to update fields
Carry out actions as part of the update methods instead of
through a trigger
Database System Concepts - 5th Edition, Aug 9, 2005.
8.31
©Silberschatz, Korth and Sudarshan
Authorization in SQL (see also Section 4.3)
Forms of authorization on parts of the database:
Read authorization - allows reading, but not modification of data.
Insert authorization - allows insertion of new data, but not modification of existing data.
Update authorization - allows modification, but not deletion of data.
Delete authorization - allows deletion of data
Database System Concepts - 5th Edition, Aug 9, 2005.
8.32
©Silberschatz, Korth and Sudarshan
Authorization (Cont.)
Forms of authorization to modify the database schema:
Index authorization - allows creation and deletion of indices.
Resources authorization - allows creation of new relations.
Alteration authorization - allows addition or deletion of attributes in a relation.
Drop authorization - allows deletion of relations.
Database System Concepts - 5th Edition, Aug 9, 2005.
8.33
©Silberschatz, Korth and Sudarshan
Authorization and Views
Users can be given authorization on views, without being given any authorization
on the relations used in the view definition
Ability of views to hide data serves both to simplify usage of the system and to
enhance security by allowing users access only to data they need for their job
A combination or relational-level security and view-level security can be used to
limit a user’s access to precisely the data that user needs.
Database System Concepts - 5th Edition, Aug 9, 2005.
8.34
©Silberschatz, Korth and Sudarshan
View Example
Suppose a bank clerk needs to know the names of the customers of each
branch, but is not authorized to see specific loan information.
Approach: Deny direct access to the loan relation, but grant access to the
view cust-loan, which consists only of the names of customers and the
branches at which they have a loan.
The cust-loan view is defined in SQL as follows:
create view cust-loan as
select branchname, customer-name
from borrower, loan
where borrower.loan-number = loan.loan-number
Database System Concepts - 5th Edition, Aug 9, 2005.
8.35
©Silberschatz, Korth and Sudarshan
View Example (Cont.)
The clerk is authorized to see the result of the query:
select *
from cust-loan
When the query processor translates the result into a query on the actual relations
in the database, we obtain a query on borrower and loan.
Authorization must be checked on the clerk’s query before query processing
replaces a view by the definition of the view.
Database System Concepts - 5th Edition, Aug 9, 2005.
8.36
©Silberschatz, Korth and Sudarshan
Authorization on Views
Creation of view does not require resources authorization since no real relation is
being created
The creator of a view gets only those privileges that provide no additional
authorization beyond that he already had.
E.g. if creator of view cust-loan had only read authorization on borrower and
loan, he gets only read authorization on cust-loan
Database System Concepts - 5th Edition, Aug 9, 2005.
8.37
©Silberschatz, Korth and Sudarshan
Granting of Privileges
The passage of authorization from one user to another may be represented by
an authorization graph.
The nodes of this graph are the users.
The root of the graph is the database administrator.
Consider graph for update authorization on loan.
An edge Ui Uj indicates that user Ui has granted update authorization on loan to
Uj.
U1
DBA
U4
U2
U5
U3
Database System Concepts - 5th Edition, Aug 9, 2005.
8.38
©Silberschatz, Korth and Sudarshan
Authorization Grant Graph
Requirement: All edges in an authorization graph must be part of some path
originating with the database administrator
If DBA revokes grant from U1:
Grant must be revoked from U4 since U1 no longer has authorization
Grant must not be revoked from U5 since U5 has another authorization path
from DBA through U2
Must prevent cycles of grants with no path from the root:
DBA grants authorization to U7
U7 grants authorization to U8
U8 grants authorization to U7
DBA revokes authorization from U7
Must revoke grant U7 to U8 and from U8 to U7 since there is no path from
DBA to U7 or to U8 anymore.
Database System Concepts - 5th Edition, Aug 9, 2005.
8.39
©Silberschatz, Korth and Sudarshan
Security Specification in SQL
The grant statement is used to confer authorization
grant <privilege list>
on <relation name or view name> to <user list>
<user list> is:
a user-id
public, which allows all valid users the privilege granted
A role (more on this later)
Granting a privilege on a view does not imply granting any privileges on the
underlying relations.
The grantor of the privilege must already hold the privilege on the specified item
(or be the database administrator).
Database System Concepts - 5th Edition, Aug 9, 2005.
8.40
©Silberschatz, Korth and Sudarshan
Privileges in SQL
select: allows read access to relation,or the ability to query using the view
Example: grant users U1, U2, and U3 select authorization on the branch relation:
grant select on branch to U1, U2, U3
insert: the ability to insert tuples
update: the ability to update using the SQL update statement
delete: the ability to delete tuples.
references: ability to declare foreign keys when creating relations.
usage: In SQL-92; authorizes a user to use a specified domain
all privileges: used as a short form for all the allowable privileges
Database System Concepts - 5th Edition, Aug 9, 2005.
8.41
©Silberschatz, Korth and Sudarshan
Privilege To Grant Privileges
with grant option: allows a user who is granted a privilege to pass the privilege on
to other users.
Example:
grant select on branch to U1 with grant option
gives U1 the select privileges on branch and allows U1 to grant this
privilege to others
Database System Concepts - 5th Edition, Aug 9, 2005.
8.42
©Silberschatz, Korth and Sudarshan
Roles
Roles permit common privileges for a class of users can be specified just once by
creating a corresponding “role”
Privileges can be granted to or revoked from roles, just like user
Roles can be assigned to users, and even to other roles
SQL:1999 supports roles
create role teller
create role manager
grant select on branch to teller
grant update (balance) on account to teller
grant all privileges on account to manager
grant teller to manager
grant teller to alice, bob
grant manager to avi
Database System Concepts - 5th Edition, Aug 9, 2005.
8.43
©Silberschatz, Korth and Sudarshan
Revoking Authorization in SQL
The revoke statement is used to revoke authorization.
revoke<privilege list>
on <relation name or view name> from <user list> [restrict|cascade]
Example:
revoke select on branch from U1, U2, U3 cascade
Revocation of a privilege from a user may cause other users also to lose that
privilege; referred to as cascading of the revoke.
We can prevent cascading by specifying restrict:
revoke select on branch from U1, U2, U3 restrict
With restrict, the revoke command fails if cascading revokes are required.
Database System Concepts - 5th Edition, Aug 9, 2005.
8.44
©Silberschatz, Korth and Sudarshan
Revoking Authorization in SQL (Cont.)
<privilege-list> may be all to revoke all privileges the revokee may hold.
If <revokee-list> includes public all users lose the privilege except those granted it
explicitly.
If the same privilege was granted twice to the same user by different grantees,
the user may retain the privilege after the revocation.
All privileges that depend on the privilege being revoked are also revoked.
Database System Concepts - 5th Edition, Aug 9, 2005.
8.45
©Silberschatz, Korth and Sudarshan
Limitations of SQL Authorization
SQL does not support authorization at a tuple level
E.g. we cannot restrict students to see only (the tuples storing) their own grades
With the growth in Web access to databases, database accesses come primarily from
application servers.
End users don't have database user ids, they are all mapped to the same database user
id
All end-users of an application (such as a web application) may be mapped to a single
database user
The task of authorization in above cases falls on the application program, with no support
from SQL
Benefit: fine grained authorizations, such as to individual tuples, can be implemented by
the application.
Drawback: Authorization must be done in application code, and may be dispersed all
over an application
Checking for absence of authorization loopholes becomes very difficult since it requires
reading large amounts of application code
Database System Concepts - 5th Edition, Aug 9, 2005.
8.46
©Silberschatz, Korth and Sudarshan
Audit Trails
An audit trail is a log of all changes (inserts/deletes/updates) to the database along with
information such as which user performed the change, and when the change was
performed.
Used to track erroneous/fraudulent updates.
Can be implemented using triggers, but many database systems provide direct
support.
Database System Concepts - 5th Edition, Aug 9, 2005.
8.47
©Silberschatz, Korth and Sudarshan
Application Security
Data may be encrypted when database authorization provisions do not offer
sufficient protection.
Properties of good encryption technique:
Relatively simple for authorized users to encrypt and decrypt data.
Encryption scheme depends not on the secrecy of the algorithm but on the
secrecy of a parameter of the algorithm called the encryption key.
Extremely difficult for an intruder to determine the encryption key.
Database System Concepts - 5th Edition, Aug 9, 2005.
8.48
©Silberschatz, Korth and Sudarshan
Encryption (Cont.)
Data Encryption Standard (DES) substitutes characters and rearranges their order on the
basis of an encryption key which is provided to authorized users via a secure mechanism.
Scheme is no more secure than the key transmission mechanism since the key has to be
shared.
Advanced Encryption Standard (AES) is a new standard replacing DES, and is based on
the Rijndael algorithm, but is also dependent on shared secret keys
Public-key encryption is based on each user having two keys:
public key – publicly published key used to encrypt data, but cannot be used to decrypt
data
private key -- key known only to individual user, and used to decrypt data.
Need not be transmitted to the site doing encryption.
Encryption scheme is such that it is impossible or extremely hard to decrypt data given only the
public key.
The RSA public-key encryption scheme is based on the hardness of factoring a very
large number (100's of digits) into its prime components.
Database System Concepts - 5th Edition, Aug 9, 2005.
8.49
©Silberschatz, Korth and Sudarshan
Authentication
Password based authentication is widely used, but is susceptible to sniffing on a
network
Challenge-response systems avoid transmission of passwords
DB sends a (randomly generated) challenge string to user
User encrypts string and returns result.
DB verifies identity by decrypting result
Can use public-key encryption system by DB sending a message encrypted
using user’s public key, and user decrypting and sending the message back
Digital signatures are used to verify authenticity of data
E.g. use private key (in reverse) to encrypt data, and anyone can verify
authenticity by using public key (in reverse) to decrypt data. Only holder of
private key could have created the encrypted data.
Digital signatures also help ensure nonrepudiation: sender
cannot later claim to have not created the data
Database System Concepts - 5th Edition, Aug 9, 2005.
8.50
©Silberschatz, Korth and Sudarshan
Digital Certificates
Digital certificates are used to verify authenticity of public keys.
Problem: when you communicate with a web site, how do you know if you are talking
with the genuine web site or an imposter?
Solution: use the public key of the web site
Problem: how to verify if the public key itself is genuine?
Solution:
Every client (e.g. browser) has public keys of a few root-level certification
authorities
A site can get its name/URL and public key signed by a certification authority:
signed document is called a certificate
Client can use public key of certification authority to verify certificate
Multiple levels of certification authorities can exist. Each certification authority
presents its own public-key certificate signed by a
higher level authority, and
Uses its private key to sign the certificate of other web sites/authorities
Database System Concepts - 5th Edition, Aug 9, 2005.
8.51
©Silberschatz, Korth and Sudarshan
End of Chapter
Database System Concepts
©Silberschatz, Korth and Sudarshan
See www.db-book.com for conditions on re-use
Database System Concepts
©Silberschatz, Korth and Sudarshan