Professional Documents
Culture Documents
Atm Document 3rd
Atm Document 3rd
Atm Document 3rd
SAI/SUDHIR INSTITUTE OF ENGINEERING 0 TECHNOLOGY FOR OMEN KUNDANPALLY KEESARA1 '###&* +##$/+#&2
1
ATM Simulator
DECLARATION
We here by declare that the project entitled SECURED/DATAPROCEEDING/IN/ BANKING/DOMAIN !b"itted in partial #!l#ill"ent o# the re$!ire"ent #or a%ard o# the de&ree o# 'achelor o# Technolo&y at SAI/SUDHIR INSTITUTE OF ENGINEERING 0 TECHNOLOGY FOR OMEN( a##iliated to !a3a4arlal N,4ru T,546olo7y U6i8,r-ity i an a!thentic %or) and ha not been !b"itted to any other *ni+er ity,In tit!te #or a%ard o# any de&ree,diplo"a-
S.S P.S
Y.RA!ES
!.NEHARIKA
Si76atur, o9 HOD
Si76atur, o9 9a5ulty
ATM Simulator
ACKNO
LEDGEMENT
o!r deep en e o# &ratit!de to :SAI OMEN #or
SUDHIR INSTITUTE OF ENGINEERING 0TECHNOLOGY FOR ba ic idea o# a project in a +ery "all period o# e"e ter-
"oti+atin& the t!dent o# o!r #ac!lty and to "a)e ! e/plore the project ( and to &et the We %i h to place on o!r record o!r deep en e o# &ratit!de to o!r project &!ide( Mr. Sa6.,,; #or hi con tant "oti+ation( +al!able help( technical &!idance and !per+i ion in carryin& o!t thi project %or)We %o!ld li)e to ta)e thi opport!nity to than) M-. Ar54a6a1 0ead o# the Depart"ent o# CSE( #or hi +al!able !&&e tion and ad+ice thro!&ho!t the '-Tech co!r e- We e/tend o!r than) to the #ac!lty o# Co"p!ter #or their co1operation( enco!ra&e"ent2inally %e %o!ld li)e to than) o!r #riend #or their cooperation to co"plete thi project-
S.S P.S
Y.RA!ES
!.NEHARIKA
ATM Simulator
+epositin! Money. These features become the functionalities. Functionalities: 'alance (nquiry Module
)ithdrawals Module Mini Statement Module.
ATM Simulator
CONTENTS
&. I6tro.u5tio655555555555555555555555551-1- 6r&ani7ation Pro#ile555555555555555555555555 1-. P!rpo e o# the Project5555555555555555555555-1-3- Proble" in E/i tin& Sy te"555555555555555555555 1-4- Sol!tion o# The e Proble" 555555555555555555555
+. F,a-i<ility Stu.y55555555555555555555555555 555.-1- Technical 2ea ibility5555555555555555555555--.-.- 6perational 2ea ibility5555555555555555555555 .-3- Econo"ic 2ea ibility5555555555555555555555--
2. A6aly-i-5555555555555555555555555 5-------------------------------3-1- Analy i "odel5555555555555555555555555 3-.- St!dy o# the Sy te"5555555555555555555553-3- 0ard%are 8 So#t%are Re$!ire"ent 555555555555555-
ATM Simulator
*. D,-i7655555555555555555555555555 555555555
4-1- E : R Dia&ra" 5555555555555555555555555-4-.- *M; Dia&ra" 55555555555555555555555554-3- Data Dictionary5555555555555555555555555--
'. Im;l,m,6tatio65555555555555555555555 5555555-9-1- I"portance o# <A=A5555555555555555555-9-. <a+a databa e connecti+ity ><D'C? 5-------------------------------------------
9-3 0TM;555555555555555555555555555-9-4 <a+a Ser+er Pa&e ><SP? 555555555555555555559-9- S@; er+er .AA9 technolo&ie 5555555555555555--
ATM Simulator
CHAPTER/&
INTRODUCTION
&.& ;ur;o-, The p!rpo e o# thi project i to de+elop a %eb application %hich i"!late the ATM Machine- 'y ! in& thi application ! er can per#or" di##erent operation %hich are bein& per#or"ed at the ATM Machine or in the ban)- 'y ! in& thi application ! er can chan&e hi pa %ord or en$!ire the balance or depo it the "oney or %ithdra% the "oney or can &enerate the "ini tate"ent-
&.+ S5o;,
The cope o# the project i +ery +a t( a it tar&et lar&e no o# people re idin& o+er the %orld- Anyone ha+in& the acce to the internet can hop #or their de ired ite" - It &ained "a/i"!" ! er o+er the %orld-
ATM Simulator chan&e hi pa %ord or en$!ire the balance or depo it the "oney or %ithdra% the "oney or can &enerate the "ini tate"ent-
+al!e i# "oney i %ithdra% - I# it reache thre hold +al!e then it ho% Mini"!"
ATM Simulator i"portantly portability o+er di##erent y te" - <a+a Ser+er Pa&e ha+e both 0TM; and <a+a Code Technolo&ie incl!ded and can ! e both o# it-
C4a;t,r /+
Sy-t,m A6aly-i-
PROBLEM DEFINITION
+.& E?i-ti67 Sy-t,m
There are o "any at" "achine are a+ailable in the %orld- In the e/i tin& y te" %e can chec) o!r balance and %ithdra% an a"o!nt #ro" the acco!nt and can &enerate "ini tate"ent b!t it i not po ible to depo it thro!&h thi at"2or in tance( ICICI ban) i pro+idin& thi depo it option b!t ! in& di##erent "achine not the "achine %hich i ! ed to %ith dra% a"o!nt-
+.2 U-,r Cla--,- a6. C4ara5t,ri-ti5Thi project tar&et at ! er %ho ha an acco!nt in the ban) and &ot ATM Card-( Thi ! er can per#or" di##erent operation li)e chan&in& pa %ord( depo itin& "oney( en$!irin& abo!t balance( and can +ie% "ini tate"ent - All the e operation are bein&
1A
ATM Simulator per#or"ed by ta)in& the ATM Card N!"ber %hich i pro+ided by the corre pondin& ban)-
+.' D,-i76 a6. Im;l,m,6tatio6 Co6-trai6tThi project %ill be de+eloped ! in& the technolo&ie li)e <a+a( <SP( Ser+let ( 0TM;( CSS( <a+aScript( S@; and Web #or all %hich I need to #etch )no%led&e on all o# the" in order to code #or the project- Al o IFll be learnin& clearly abo!t So#t%are De+elop"ent ;i#e Cycle-
11
it4.ra3 Mo.ul,@ 'y ! in& thi "od!le ! er per#or" %ithdra% operation( thi operation %or) a "entioned belo%When ! er enter %ithdra% a"o!nt it chec) %hether there i the acco!nt- I# there i !##icient a"o!nt in !##icient a"o!nt a&ain it chec) %hether it reache the thre hold
+al!e i# "oney i %ithdra% - I# it reache thre hold +al!e then it ho% Mini"!" balance "e a&e- I# it doe not reach the thre hold +al!e then it %ill chec) ho% "!ch "oney ha been %ithdra%n on that day- I# that reache .9(AAA then it %ill ho% Me a&e other %i e it proce D,;o-it Mo.ul,J Thi "od!le allo% the ! er to depo it an a"o!nt o# "oney into acco!nt- When ! er enter depo itin& a"o!nt( it %ill a ) the ! er to deno"inate #or that a"o!nt- 6nce ! er enter correct deno"ination the tran action %ill be preceded and then ho% !cce #!l "e a&e to ! erBala65, E6Auiry Mo.ul,@ Thi "od!le let the ! er to )no% abo!t the c!rrent tat! o# the acco!nt i-e-( the balance o# the acco!ntthe operation-
Mi6i Stat,m,6t Mo.ul,J Thi "od!le &i+e the "ini tate"ent o# an acco!nt- When ! er ! e thi "od!le to )no% +ie% a "ini tate"ent then it ho% the la t 1A tran action that %ere per#or"ed on hi KK acco!nt alon& %ith the detail li)e type o# tran action >Withdra%,Depo it?Lthat %a per#or"ed
1.
ATM Simulator
So9t
ar, R,Auir,m,6tTool JJ Micro So#t 2ront 6peratin& Sy te"JJ Windo% NT,.AAA Ser+er SideJJ <SP %ith To"cat Ser+er Client SideJJ 0TM; (<a+aScript Ser+ice JJ <D'C Databa eJJ My S@; Inte&rated De+elop"ent En+iron"entJ Net'ean C-9
13
ATM Simulator
C4a;t,r C 2
FEASIBILITY STUDY
2. FEASIBILITY STUDY@
The ne/t tep in analy i i to +eri#y the #ea ibility o# the propo ed y te"- All project are #ea ible &i+en !nli"ited re o!rce and in#inite ti"e- '!t in reality both re o!rce and ti"e are carce- Project ho!ld con#ir" to ti"e bo!nce and ho!ld be opti"al in there con !"ption o# re o!rce - Thi place a con tant i appro+al o# any project2ea ibility ha applied to ATM Simulator pertain to the #ollo%in& area J Technical #ea ibility 6perational #ea ibility Econo"ical #ea ibility
2.& TECHNICAL FEASIBILITY@ To deter"ine %hether the propo ed y te" i technically #ea ible( %e ho!ld ta)e into con ideration the technical i !e in+ol+ed behind the y te"-
14
ATM Simulator ATM Simulator ! e the %eb technolo&ie ( %hich i ra"pantly e"ployed the e day %orld%ide- The %orld %itho!t the %eb i inco"prehen ible today- That &oe to propo ed y te" i technically #ea ible2.+ OPERATIONAL FEASIBILITY@ To deter"ine the operational #ea ibility o# the y te" %e ho!ld ta)e into con ideration the a%arene le+el o# the ! er - Thi y te" i operational #ea ible ince the ! er are #a"iliar %ith the technolo&ie and hence there i no need to &ear !p the per onnel to ! e y te"- Al o the y te" i +ery #riendly and to ! e-
2.2. ECONOMIC FEASIBILITY To decide %hether a project i econo"ically #ea ible( %e ha+e to con ider +ario! #actor aJ Co t bene#it analy i ;on&1ter" ret!rn Maintenance co t The propo ed ATM Simulator i co"p!ter ba ed- It re$!ire a+era&e co"p!tin& capabilitie and acce to internet( %hich are +ery ba ic re$!ire"ent hence it doe nFt inc!r additional econo"ic o+erhead ( %hich render the y te" econo"ically #ea ible-
19
ATM Simulator
C4a;t,r C *
SYSTEM DESIGN
SYSTEM DESIGN
Sy te" de i&n i tran ition #ro" a ! er oriented doc!"ent to pro&ra""er or data ba e per onnel- The de i&n i a ol!tion( ho% to approach to the creation o# a ne% y te"- Thi i co"po ed o# e+eral tep - It pro+ide the !nder tandin& and proced!ral detail nece ary #or i"ple"entin& the y te" reco""ended in the #ea ibility t!dyDe i&nin& &oe thro!&h lo&ical and phy ical ta&e o# de+elop"ent( lo&ical de i&n re+ie% the pre ent phy ical y te"( prepare inp!t and o!tp!t peci#ication( detail o# i"ple"entation plan and prepare a lo&ical de i&n %al)thro!&hThe databa e table are de i&ned by analy7in& #!nction in+ol+ed in the y te" and #or"at o# the #ield i al o de i&ned- The #ield in the databa e table ho!ld de#ine their role in the y te"- The !nnece ary #ield ho!ld be a+oided beca! e it a##ect the tora&e area o# the y te"- Then in the inp!t and o!tp!t creen de i&n( the de i&n ho!ld be "ade ! er #riendly- The "en! ho!ld be preci e and co"pact-
SOFT
ARE DESIGN
In de i&nin& the o#t%are #ollo%in& principle are #ollo%edJ 1- Mo.ularity a6. ;artitio6i67J o#t%are i de i&ned !ch that( each y te" ho!ld con i t o# hierarchy o# "od!le and er+e to partition into eparate #!nction.- Cou;li67@ "od!le 3- Co4,-io6@ "od!le ho!ld ha+e little dependence on other "od!le o# a y te"ho!ld carry o!t in a in&le proce in& #!nction-
1C
ATM Simulator 4- S4ar,. u-,@ a+oid d!plication by allo%in& a in&le "od!le i called by other that need the #!nction it pro+ide
1B
ATM Simulator
Deposite
extend
With Draw
Cla-- Dia7ram
1D
ATM Simulator
'ccount%(ype 'ccount(ype%Id&int 'ccount%)um$er&int 1 User 'ccount%)um$er&int )ame&String 'ddress&S(ring 1..* .ccupation&String .pening%Date&Date Mo$ile)o/String 1 *assWord&String 1 0ender&String 1 1 1..* Balance Enquiry12&int Deposite12&String WithDraw12&int Ministatement12& '(M 1 '(M%)um$er&int 'ddress&String
1..*
1
1..*
1..*
1G
ATM Simulator
User Login Authentication Authenticating Displays enu Valid User System Database
Selects Deposite Displayse Deposite!orm Update the Deposite and #alance in$ormation Updating Updated
.A
ATM Simulator
SNO 1 .
REFERENCES FROM
SNO 1 . 3 4
CONSTRAINTS "KEY( PRIMARN MEN N6T N*;; N6T N*;; N6T N*;;
REFERENCES FROM
AtmEMa54i6,
A55ou6tETy;,
.1
ATM Simulator
SNO 1 . 3 4 9 C B D G 1A
COLUMN NAME ACC6*NTLN*M'ER>PM? NAME ADDRESS 6CC*PATI6N 6PENEDLDATE M6'I;EN6 EENDER CARDID>2M? 'RANC0LID>2M? ACC6*NTTNPELID >2M?
DATA TYPE "SIFE( INT>19? =ARC0AR>4A? =ARC0AR>4A? =ARC0AR>4A? DATE INT =ARC0AR>C? INT>19? INT>19? INT>19?
CONSTRAINTS "KEY( PRIMARN MEN N6T N*;; N6T N*;; N6T N*;; N6T N*;; N6T N*;; N6T N*;; N6T N*;; N6T N*;; N6T N*;;
REFERENCES FROM
SNO 1 . 3 4
CONSTRAINTS "KEY( PRIMARN MEN N6T N*;; N6T N*;; N6T N*;;
REFERENCES FROM
ACC6*NTLTNPE
USEREACCOUNT
SNO 1 .
REFERENCES FROM
ITHDRA
..
ATM Simulator
SNO 1 . 3 4 9 C B D
COLUMN NAME DEP6SITLID>PM? AM6*NT DEP6SIT LDATE T06*SANDS 2I=E 0*DREDS 0*NDREDS ACC6*NTLN*M'ER>2M? ATMLID
DATA TYPE "SIFE( INT>19? INT>19? DATE INT>19? INT>19? INT>19? =ARC0AR>4A? INT>19?
CONSTRAINTS "KEY( PRIMARN MEN N6T N*;; N6T N*;; N6T N*;; N6T N*;; N6T N*;; N6T N*;; N6T N*;;
REFERENCES FROM
ACC6*NTLTNPE ATMLMAC0INE
DEPOSIT
*.* ER Dia7ramSNO 1 . 3 4 9 COLUMN NAME WIT0DRAWLID>PM? WIT0DRAWLAM6*NT WIT0DRAWLDATE ACC6*NTLN*M'ER>2M? ATMLID DATA TYPE "SIFE( INT>19? INT>19? DATE =ARC0AR>4A? INT>19? CONSTRAINTS "KEY( PRIMARN MEN N6T N*;; N6T N*;; N6T N*;; N6T N*;; REFERENCES FROM
ACC6*NTLTNPE ATMLMAC0INE
U-,rEA55ou6t
%ith
Bra654
.3
ATM Simulator
USEREACCOUNT
BRANCH
U-,rEA55ou6t
%ith
<ala65,
GUSEREACCOUNT
ATM Simulator
BALANCE
U-,rEA55ou6t
%ith
3it4.ra3
GUSEREACCOUNT
ITHDRA
.9
ATM Simulator
U-,rEA55ou6t
%ith
D,;o-it
GUSEREACCOUNT
DEPOSIT
.C
ATM Simulator
ATMEma54i6,
%ith
D,;o-it
ATMEMACHINE
ATMLID>PM? ADDRESS
DEPOSIT
ATMEma54i6,
%ith
3it4.ra3
ATMEMACHINE
ATMLID>PM? ADDRESS
ITHDRA
ATM Simulator
ATMEma54i6,
%ith
<ra654
ATMEMACHINE
Aut4,6ti5atio6
3it4
Car.
AUTHENTICATION
.D
ATM Simulator
DEPOSIT
DEP6SITLID>PM? AM6*NT DEP6SIT LDATE T06*SANDS 2I=E 0*DREDS 0*NDREDS ACC6*NTLN*M'ER>2M? ATMLID>2M?
Tra6-a5tio6
i o# type
D,;o-it
Tra6-a5tio6
i o# type
3it4.ra3
.G
ATM Simulator
TRANSACTION TRANSACTI6NLID>PM?
ITHDRA
Tra6-a5tio6
i o# type
u-,rEa55ou6t
TRANSACTION TRANSACTI6NLID>PM?
USEREACCOUNT
3A
ATM Simulator
Out;ut .,-i76@ All the creen o# the y te" are de i&ned %ith a +ie% to pro+ide the ! er %ith ea y operation in i"pler and e##icient %ay( "ini"!" )ey tro)e po ibleIn tr!ction and i"portant in#or"ation i e"pha i7ed on the creen- Al"o t e+ery creen i pro+ided %ith no error and i"portant "e a&e and option election #acilitate E"pha i i &i+en #or peedy proce in& and peedy tran action bet%een the creen 31
ATM Simulator Each creen a i&ned to "a)e it a "!ch ! er #riendly a po ible by ! in& interacti+e proced!re - So to ay ! er can operate the y te" %itho!t "!ch help #ro" the operatin& "an!al-
3.
IMPLEMENTATION
O>ER>IE
%.& HTML 0t"l i a lan&!a&e %hich i ! ed to create %eb pa&e %ith ht"l "ar)in& !p a pa&e to indicate it #or"at( tellin& the %eb bro% er %here yo! %ant a ne% line to be&in or ho% yo! %ant te/t or i"a&e ali&ned and "ore are po ibleWe ! ed the #ollo%in& ta& in o!r projectTABLE@ Table are o pop!lar %ith %eb pa&e a!thor i that they let yo! arran&e the ele"ent o# a %eb pa&e in !ch a %ay that the bro% er %onFt rearran&e the" %eb pa&e a!thor #re$!ently ! e table to tr!ct!re %eb pa&e HTRI@ HTRI i ! ed to create a ro% in a table enclo e PT0Q and PTDQ ele"ent - PTRQ contain "any attrib!te - So"e o# the" are( HTHI@ PT0Q i ! ed to create table headin&A;IENJ peci#ie the hori7ontal ali&n"ent o# the te/t in the table ro%'EC6;6RJ Speci#ie the bac)&ro!nd color #or the ro%'6RDERC6;6RJ Set the e/ternal border color #or the ro%=A;IENJ Set the +ertical ali&n"ent o# the data in thi ro%-
33
ATM Simulator HTDI@ PTDQ i ! ed to create table data that appear in the cell o# a table FRAMES@ 2ra"e are ! ed #or either r!n o## the pa&e or di play only "all lice o# %hat are !ppo ed to be ho%n and to con#i&!re the #ra"e %e can ! e P2RAMESETQthere are t%o i"portant point P2RAMESETQ P2RAMESETQ ele"ent act!ally ta)e the place o# the P'6DNQ ele"ent in a doc!"entSpeci#yin& act!al pi/el di"en ion #or #ra"e to con ider %hen %or)in& %ith A;IENJ Specie the hori7ontal ali&n"ent o# content in the table cell- Set to ;E2T( CENTER( RIE0T'EC6;6RJ Speci#ie the bac)&ro!nd i"a&e #or the table cell'EC6;6RJ et the bac)&ro!nd color o# the table cell WIDT0J Specie the %idth o# the cell A;IENJ Set the hori7ontal ali&n"ent o# the content in the table cell- Set ;E2T( RIE0T( CENTER'ACMER6*NDJ Specie the bac) &ro!nd i"a&e #or the table cell'EC6;6RJ Speci#ie the bac)&ro!nd color o# the table cell =A;IENJ Set the +ertical ali&n"ent o# the data- Set to T6P( MIDD;E( '6TT6M or 'ASE;INEWIDT0J Speci#ie the %idth o# the cell- Set to a pi/el %idth or a percenta&e o# the di play area-
34
ATM Simulator 2ro" the #ra"e et point o# +ie% di+idin& the bro% er into to% +ertical #ra"e "ean creatin& t%o col!"n ! in& the P2RAMESETQ ele"ent C6;S attrib!teThe ynta/ #or +ertical #ra&"entation i ( P2RAMESET C6;S R9AS( 9ASQ P,2RAMESETQ Si"ilarly i# %e replace C6;S %ith R6WS then %e &et hori7ontal #ra&"entationThe ynta/ #or hori7ontal #ra&"entation i ( P2RAMESET R6WSR9AS( 9ASQ P,2RAMESETQ FORM@ The p!rpo e o# 26RM i to create an 0TM; #or"T ! ed to enclo e 0TM; control ( li)e b!tton and te/t #ield ATTRIBUTES@ ACTI6NJ Ei+e the *R; that %ill handle the #or" data-
tar&et action *R;- The EET "ethod i the de#a!lt( it i ! ed to end all #or" na"e,+al!e pair in#or"ation in an *R;- * in& the P6ST "ethod( the content o# the #or" are encoded a %ith the EET "ethod( b!t are ent in en+iron"ent +ariable CONTROLS IN HTML HINP*T TNPE R'*TT6NQJ Create an ht"l b!tton in a #or"39
ATM Simulator ATTRI'*TESJ NAMEJ &i+e the ele"ent a na"e- Set to alphan!"eric character SIUEJ et the i7e=A;*EJ et the caption o# the ele"ent-
HINP*T TNPE R PASSW6RDQJ Create a pa %ord te/t #ield( %hich "a)e typed inp!tATTRI'*TESJ NAMEJ &i+e the ele"ent a na"e( et to alphan!"eric character =A;*EJ et the de#a!lt content o# the ele"ent-
PINP*T TNPERRADI6QJ Create a radio b!tton in a #or"ATTRI'*TEJ NAMEJ Ei+e the ele"ent a na"e- Set to alphan!"eric character=A;*EJ Set the de#a!lt content o# the ele"ent-
PINP*T TNPERS*'MITQJ Create a !b"it b!tton that the ! er can clic) to end data in the #or" bac) to the %eb er+erATTRI'*TESJ NAMEJ Ei+e the ele"ent a na"e- Set to alphan!"eric character =A;*EJ Ei+e thi b!tton another label be ide the de#a!lt( S!b"it @!ery- Set to alphan!"eric character HINP*T TNPERTEOTQJ Create a te/t #ield that the ! er can enter or edit te/t inATTRI'*TESJ NAMEJ Ei+e the ele"ent a na"e- Set to alphan!"eric character =A;*EJ 0old the initial te/t in the te/t #ield- Set to alphan!"eric character -
3C
ATM Simulator
%.+ !A>A SCRIPT <a+a cript ori&inally !pported by Net cape na+i&ator i the "o t pop!lar %eb criptin& lan&!a&e today- <a+a cript let yo! e"bedded pro&ra" ri&ht in yo!r %eb pa&e and r!n the e pro&ra" ! in& the %eb bro% erNo! place the e pro&ra" in a PSCRIPTQ ele"ent( ! !ally %ith in the P0EADQ ele"ent- I# yo! %ant the cript to %rite directly to the %eb pa&e( place it in the P'6DNQ ele"ent-
!A>ASCRIPT METHODS@
rit,l6@ Doc!"ent-%riteln >? i a "ethod( %hich i ! ed to %rite o"e te/t to the c!rrent %eb pa&eO6Cli5J@ 6cc!r %hen an ele"ent i clic)edo6Loa.@ 6cc!r %hen the pa&e load o6Mou-,Do36@ 6cc!r %hen a "o! e b!tton &oe do%no6Mou-,Mo8,@ 6cc!r %hen the "o! e "o+e o6U6loa.@ 6cc!r %hen a pa&e i !nloaded-
3B
ATM Simulator %.2 MySBL The databa e ha beco"e an inte&ral part o# al"o t e+ery h!"anV li#e- Witho!t it( "any thin& %e do %o!ld beco"e +ery tedio! ( perhap i"po ible ta ) - 'an) ( !ni+er itie ( and librarie are three e/a"ple o# or&ani7ation that depend hea+ily on o"e ort o# databa e y te"- 6n the Internet( earch en&ine ( ATM ( and e+en the %eb ite na"in& con+ention >httpJ,,%%%---? %o!ld be i"po ible %itho!t the ! e o# a databa e- A databa e that i i"ple"ented and inter#aced on a co"p!ter i o#ten ter"ed a databa e er+er6ne o# the #a te t S@; >Str!ct!red @!ery ;an&!a&e? databa e er+er c!rrently on the "ar)et i the MyS@; er+er-MyS@;( a+ailable #or do%nload( o##er the databa e pro&ra""er %ith an array o# option and capabilitie rarely een in other databa e er+er - WhatV "ore( MyS@; i #ree o# char&e #or tho e %i hin& to ! e it #or pri+ate and co""ercial ! e- Tho e %i hin& to de+elop application peci#ically ! in& MyS@; ho!ld con !lt MyS@;V licen in& ection( a there i a char&e #or licen in& the prod!ctThe e capabilitie ran&e acro
Ability to handle an !nli"ited n!"ber o# i"!ltaneo! ! er Capacity to handle 9A(AAA(AAAH record =ery #a t co""and e/ec!tion( perhap the #a te t to be #o!nd on the "ar)etEa y and e##icient ! er pri+ile&e y te"-
A databa e i really nothin& "ore than a hierarchy o# increa in&ly co"ple/ data tr!ct!re - In MyS@;( the ac)no%led&ed tr!ct!re #or holdin& bloc) >or r,5or.-? o# in#or"ation i called the ta<l,The e record ( in t!rn( are "ade !p o# the "alle t object that can be "anip!lated by the ! er( )no%n a the .ata ty;,- Toðer( one or "ore o# the e data type #or" a record- A
3D
ATM Simulator table hold the collection o# record that "a)e !p part o# the databa e- We can con ider the hierarchy o# a databa e to be that o# the #ollo%in&J Databa e P Table P Record P Datatype Datatype co"e in e+eral #or" and i7e ( allo%in& the pro&ra""er to create table !ited #or the cope o# the project- The deci ion "ade in choo in& proper datatype &reatly in#l!ence the per#or"ance o# a databa e( o it i %i e to ha+e a detailed !nder tandin& o# the e concept MySBL Dataty;,MyS@; i capable o# "any o# the datatype that e+en the no+ice pro&ra""er ha probably already been e/po ed to- So"e o# the "ore co""only ! ed incl!deJ
CHAR (M)
C0ARV are ! ed to repre ent #i/ed len&th trin& - A C0AR trin& can ran&e #ro" 11.99 character - In later table creation( an e/a"ple C0AR datatype %o!ld be declared a #ollo% J e/car_model CHAR(10); VARCHAR (M)
=ARC0AR i a "ore #le/ible #or" o# the C0AR data type- It al o repre ent data o# type Strin&( yet tore thi data in +ariable len&th #or"at- A&ain( =ARC0AR can hold 11 .99 character - =ARC0AR i ! !ally a %i er choice than C0AR( d!e to itV +ariable len&th #or"at characteri tic- Altho!&h( )eep in "ind that C0AR i "!ch #a ter than =ARC0AR( o"eti"e !p to 9AS>A C0AR tore the %hole len&th o# the declared +ariable( re&ardle red!cin& i7e o# the databa e #ile-? e/car_model VARCHAR(10);
data contained %ithin( %herea a =ARC0AR only tore the len&th o# the data( th!
3G
ATM Simulator
INT (M) [Unsigned]
The INT datatype tore inte&er ran&in& #ro" 1.14B4D3C4D to .14B4D3C4B- An optional W!n i&nedW can be denoted %ith the declaration( "odi#yin& the ran&e to be A to 4.G4GCB.G9 e/light_years INT;
Thi co!ld be ! ed to repre ent rain#all a+era&e in centi"eter per year( %hich co!ld be a deci"al +al!e- More peci#ically( 2;6AT >4(.? tate the #act that rain#all can hold !p to #o!r character and t%o deci"al place - Th! ( 4.-39 i +alid( acc!rately repre ented3.4-49 i in+alid( ro!nded to 3.4-9.-. i +alid( acc!rately repre ented34-94. i in+alid( ro!nded to 34-94Note: Due to the fact that FLOAT is rounded, those wishing to represent money alues would find it wise to use DEC !A", a datatype found within !y"#L that does not round alues$ %onsult the documentation for a complete e&planation$
DATE
Store date related in#or"ation- The de#a!lt #or"at i VNNNN1MM1DDV( and ran&e #ro" VAAAA1AA1AAV to VGGGG11.131V- MyS@; pro+ide a po%er#!l et o# date #or"attin& and
4A
ATM Simulator "anip!lation co""and ( too n!"ero! to be co+ered %ithin thi article- 0o%e+er( one can #ind the e #!nction co+ered in detail %ithin the MyS@; doc!"entationthe_date DATE; TEXT / BLOB
The te/t and blob datatype are ! ed %hen a trin& o# .99 1 C9939 character i re$!ired to be tored- Thi i ! e#!l %hen one %o!ld need to tore an article !ch a the one yo! are readin&- 0o%e+er( there i no end pace tr!ncation a %ith =ARC0AR AND C0ARThe only di##erence bet%een ';6' and TEOT i that TEOT i co"pared ca e in en iti+ely( %hile ';6' i co"pared ca e en iti+elySET
A datatype o# type trin& that allo% one to choo e #ro" a de i&nated et o# +al!e ( be it one +al!e or e+eral +al!e - 6ne can de i&nate !p to C4 +al!e e/transport SET ("truck", "wagon") NOT NULL;
2ro" the abo+e declaration( the #ollo%in& +al!e can be held by tran portJ
"" "truck" "wagon" "truck,wagon" ENUM
A datatype o# type trin& that ha the a"e characteri tic a the SET datatype( b!t only one et o# allo%ed +al!e "ay be cho en- * !ally only ta)e !p one byte o# pace( th! a+in& ti"e and pace %ithin a tablee/transport ENUM ("truck", "wagon") NOT NULL;
2ro" the abo+e declaration( the #ollo%in& +al!e can be held by tran portJ
41
ATM Simulator
"" "Truck" "wagon"
R,5or.Toðer( a &ro!p o# declared datatype #or" %hat i )no%n a a record- A record can be a "all a one data +ariable( or a "any a dee"ed needed- 6ne or "ore record #or" the tr!ct!re o# a tableT4, Bi77,r Pi5tur,@ Ta<l,'e#ore %e can e/ec!te co""and on the databa e( %e "! t #ir t create a table in %hich data can be tored- Thi i acco"pli hed in the #ollo%in& "annerJ
Mysql> CREATE TABLE test ( > name VARCHAR (15), > email VARCHAR (25), > phone_number INT, > ID INT NOT NULL AUTO_INCREMENT, > PRIMARY KEY (ID));
En !in& o!tp!tJ
Query OK, 0 rows affected (0.10 sec) mysql>
The #ir t table in yo!r databa e ha no% been created- Note: no two ta'les can ha e the same name$ Note ()*: +ach data space is more often referred to as a column$ Colum6 C4ara5t,ri-ti5-@
A na"e "ay not be "ade !p o# trictly n!"ber A na"e "ay tart %ith a n!"berA na"e "ay be !p to C4 character -
4.
ATM Simulator Ot4,r ta<l, o;tio6-@ The #ollo%in& option can be placed a#ter any datatype( addin& other characteri tic and capabilitie to the"
Pri"ary Mey- * ed to di##erentiate one record #ro" another- No t%o record can ha+e the a"e pri"ary )ey- Thi i ob+io! ly ! e#!l %hen it i i"perati+e that no t%o record are "i ta)en to be the other-
A!toLIncre"ent- A col!"n %ith thi #!nction i a!to"atically incre"ented one +al!e >pre+io! H 1? %hen an in ertion i "ade into the record- The datatype i a!to"atically incre"ented %hen VN*;;V i in erted into the col!"n-
N6T N*;;- Si&ni#ie that the col!"n can ne+er be a i&ned a N*;; +al!e-
No t%o ocL ecLn!"ber record can hold the a"e +al!eID_NUMBER INT AUTO_INCREMENT;
I6-,rtio6 o9 r,5or.Not,@ The ori&inally created table( te t( created in the la t ection %ill be ! ed to ill! trate the e/a"ple in thi ection- 0ere it i a&ain( #or $!ic) re#erenceJ
MySQL> CREATE TABLE test ( > Name VARCHAR (15), > email VARCHAR (25), > Ph !e !"m#e$ %NT, > %& %NT N'T N(LL A(T')%NCREMENT, > PR%MAR* +E* (%&)),
In ertion o# data into the table i acco"pli hed( lo&ically eno!&h( ! in& the INSERT co""andMySQL> %NSERT %NT' test VAL(ES MySQL> (-B".s B"!!y-, -/a$$ ts01e2she13/ m-, Mys4l> 5555621, N(LL),
43
S,l,5tio6 A databa e %o!ld not be "!ch ! e i# one %a not able to earch and e/tract data #ro" itIn MyS$l ter" ( thi i acco"pli hed thro!&h the SE;ECT tate"entMys4l> SELECT : ;R'M test Mys4l> <HERE (!ame = >B".s B"!!y>),
Re !ltJ
name email phone ID Bugs Bunny carrots@devshed.com 5554321 1
;etV a !"e %e ha+e in erted #o!r di##erin& record ( all bearin& the a"e na"e o# W'!& '!nnyW( yet ha+in& di##erent e"ail addre e and phone n!"ber - The table te t( %o!ld loo) o"e%hat li)e the #ollo%in&J
name Email phone ID
5554321 1
Bugs Bunny peppers@devshed.com 5554331 2 Bugs Bunny lettuce@devshed.com Bugs Bunny celery@devshed.com 5554341 3 5554351 4
D,l,tio6 6ne can al o delete record in erted into the table- Thi i acco"pli hed thro!&h the DE;ETE co""andmys4l> &ELETE ;R'M test Mys4l> <HERE (!ame = >B".s B"!!y>),
Re !ltJ Thi %o!ld re !lt in the deletion o# all record %ithin the table te t containin& na"e W'!& '!nnyWAnother e/a"pleJ
Mys4l> &ELETE ;R'M test
44
ATM Simulator
Mys4l> <HERE (?h !e)!"m#e$ = 5555621),
Bugs Bunny peppers@devshed.com 5554331 2 Bugs Bunny lettuce@devshed.com Bugs Bunny celery@devshed.com 5554341 3 5554351 4
Mo.i9i5atio6 MyS@; al o ha the capability o# "odi#yin& data already entered into the table- Thi i acco"pli hed thro!&h the *PDATE co""andMys4l> (P&ATE test SET !ame = -&a88y &"/@Mys4l> <HERE !ame = >B".s B"!!y>,
name
phone
ID
Daffy Duck peppers@devshed.com 5554331 2 Daffy Duck lettuce@devshed.com Daffy Duck celery@devshed.com 5554341 3 5554351 4
Thi ection( %e co+ered the core MyS@; databa e "anip!lation #!nction ( ba ic in ertion( deletion( "odi#ication( and earch- The ne/t ection %ill elaborate on the e capabilitie ( pro+idin& e/tended #!nctionin& and #le/ibility %hen "anip!latin& the databa eWhat %e ha+e co+ered o #ar i b!t a "all part o# %hat MyS@; i capable o#- ;etV del+e a little deeper into the lan&!a&e( e/plorin& o"e o# the "ore ad+anced co""and o# the lan&!a&eLo7i5al O;,ratio6MyS@; incl!de #!ll !pport o# all ba ic lo&ical operation AND "00(
Mys4l> SELECT : ;R'M test <HERE Mys4l> (!ame = >B".s B"!!y>) AN& Mys4l> (?h !e)!"m#e$ = 5555621),
49
ATM Simulator Re !ltJ All record containin& the na"e W'!& '!nnyW AND the phone n!"ber V99943.1V %ill be di played to the creenOR " KK (
Mys4l> SELECT : ;R'M test <HERE Mys4l> (!ame = >B".s B"!!y>) 'R Mys4l> (?h !e)!"m#e$ = 5555621),
Re !ltJ All record containin& the na"e W'!& '!nnyW 6R the phone n!"ber V99943.1V %ill be di played to the creenNOT "L(
Mys4l> SELECT : ;R'M test <HERE MySQL> (!ameA = >B".s B"!!y>),
Re !ltJ All record N6T containin& the na"e W'!& '!nnyW %ill be di played to the creenOr.,r By
Mys4l> SELECT : ;R'M test <HERE Mys4l> (!ame = >B".s B"!!y>) 'R&ER B* Mys4l> ?h !e)!"m#e$,
Re !ltJ All record containin& the na"e W'!& '!nnyW %ill be di played to the creen( ordered in re pect to the phoneLn!"berS,ar54 9u65tio6MyS@; o##er the ! er the ability to per#or" both &eneral and peci#ic earche on dataMys4l> SELECT : ;R'M test <HERE Mys4l> (!ame L%+E >Bas B"!!y>),
Re !ltJ All record containin& the partial trin& W& '!nnyW %ill be di played to the creen- Thi %o!ld incl!de !ch na"e a J W'!& '!nnyW( Wa& '!nnyW( W& '!nnyW( and W.34rt& '!nnyW-
4C
ATM Simulator Notice that W;IMEW ha been ! ed in tead o# the e$!al i&n >R?- W;IMEW i&ni#ie that one i earchin& #or an e ti"ate o# the data re$!e ted( and not nece arily an e/act copyThe VSV i&n co!ld be placed any%here %ithin the trin&- The "ethod in %hich the er+er earche #or a trin& i dependent !pon %here one place the VSV i&nMys4l> SELECT : ;R'M test <HERE Mys4l> (!ame L%+E >B".s B"!!y B>),
Re !ltJ All record containin& the partial trin& W'!& '!nnyW %ill be di played to the creenThi %o!ld incl!de !ch na"e a J W'!& '!nny W( W'!& '!nnyyyy493W( W'!& '!nnytrtrtrtrtrW( b!t not W& '!nnyWFo5u-,. S,ar54 R,-ult6ne can al o per#or" earche and di play only certain col!"n Mys4l> SELECT !ame ;R'M test <HERE Mys4l> (!ame = >B".s B"!!y>),
Re !ltJ
name Bugs Bunny
Alt,r ta<l, Another +ery i"portant #!nction o# MyS@; i the ability to "odi#y pre+io! ly created table - Thi i acco"pli hed +ia the A;TER tate"ent- Thi #!nction allo% one to add( "odi#y( and delete col!"n ( a %ell a rena"e the table( a"on& other #!nction E/a"pleJ Rena"e the table
Mys4l> ALTER ta#le test RENAME mytest,
4B
ATM Simulator
Mys4l> ALTER ta#le mytest CHANCE Mys4l> !ame !e7!ame VARCHAR (25),
E/ec!tin& the abo+e #o!r #!nction %o!ld "odi#y te t( creatin& the #ollo%in& tableJ
Mys4l> TABLE mytest ( > email VARCHAR (25), > Ph !e !"m#e$ %NT, > %& %NT A(T')%NCREMENT, > #i$th1ay &ATE),
DRI>ER MANAGER AND DRI>ER@ The ja+a- $l pac)a&e de#ine an inter#ace called <a+a- $l-Dri+er that "a)e to be i"ple"ented by all the <D'C dri+er and a cla called 4D
ATM Simulator ja+a- $l-Dri+erMana&er that act a the inter#ace to the databa e client #or per#or"in& ta ) li)e connectin& to e/ternal re o!rce "ana&er ( and ettin& lo& trea" - When a <D'C client re$!e t the Dri+erMana&er to "a)e a connection to an e/ternal re o!rce "ana&er( it dele&ate the ta ) to an approate dri+er cla i"ple"ented by the <D'C dri+er pro+ided either by the re o!rce "ana&er +endor or a third party-
!A>A.SBL.DRI>ERMANAGER@ The pri"ary ta ) o# the cla Eettin& connection to the databa e Mana&in& <D'C lo& Settin& lo&in ti"eo!tdri+er "ana&er i to "ana&e the +ario! <D'C dri+er re&i ter- It al o pro+ide "ethod #orJ
MANAGING DRI>ERS@ <D'C client peci#y the <D'C *R; %hen they re$!e t a connection- The dri+er "ana&er can #ind a dri+er that "atche the re$!e t *R; #ro" the li t o# re&i ter dri+er and dele&ate the connection re$!e t to that dri+er i# it #ind a "atch <D'C *R; nor"ally ta)e the #ollo%in& #or"atJ HProto5olI @H -u</;roto5olI @H r,-our5,I The protocol i al%ay jdbc and the !b1protocol and re o!rce depend on the type o# re o!rce "ana&er- The *R; #or po t&reS@; i in the #or"atJ !.<5@ ;o-t7r,- @DDH 4o-tI @H ;ortIDH.ata<a-,I 0ere ho t i the ho t addre on %hich po t "a ter i r!nnin& and databa e i the na"e o# the databa e to %hich the client %i he to connect-
MANAGING CONNECTION@ Dri+erMana&er cla i re pon ible #or "ana&in& connection to the databa e J
4G
ATM Simulator P!blic tatic Connection &etConnection >Strin& !rl( Propertie in#o? thro% S@;E/ception Thi "ethod &et a connection to the databa e by the peci#ied <D'C *R; ! in& the peci#ied ! erna"e and pa %ord- Thi error occ!r "ethod thro% an in tance o# S@;E/ception i# a databa e acce CONNECTIONS@ The inter#ace ja+a- $l-Connection de#ine the "ethod re$!ired #or a per i tent connection to the databa e- The <D'C dri+er +endor i"ple"ent thi inter#ace- A databa e X+endor1ne!tralF client ne+er ! e the i"ple"entation cla and %ill al%ay ! e only the inter#ace- Thi inter#ace de#ine "ethod #or the #ollo%in& ta ) J State"ent ( prepared tate"ent ( and callable tate"ent are the di##erent type o# tate"ent #or i !in& $l tate"ent to the databa e by the <D'C client 2or &ettin& and ettin& a!to1co""it "odeEettin& Meta in#or"ation abo!t the databa eCo""ittin& and rollin& bac) tran action -
CREATING STATEMENTS@ The inter#ace ja+a- $l-Connection de#ine a et o# "ethod #or creatin& databa e tate"ent - Databa e tate"ent are ! ed #or endin& S@; tate"ent to the databa eJ P!blic State"ent createState"ent >? thro% S@;E/ception Thi "ethod i ! ed #or creatin& in tance o# the inter#ace ja+a- $l-State"ent- Thi inter#ace can be ! ed #or endin& S@; tate"ent to the databa e- The inter#ace ja+a- $l-State"ent i nor"ally ! ed #or endin& S@; tate"ent that donFt ta)e any ar&!"ent - Thi "ethod thro% an in tance o# S@;E/ception i# a databa e acce occ!r J P!blic State"ent createState"ent >int re Type( int re Conc!rrency? thro% S@;E/ception error
9A
ATM Simulator
!DBC RESULTSETS@ A <D'C re !lt et repre ent a t%o di"en ional array o# data prod!ced a a re !lt o# e/ec!tin& S@; SE;ECT tate"ent a&ain t databa e ! in& <D'C tate"ent - <D'C re !lt et are repre ented by the inter#ace ja+a- $l-Re !ltSet- The <D'C +endor pro+ider pro+ide the i"ple"entation cla SCROLLING RESULTSETS@ P!blic 'oolean ne/t >? thro% S@;E/ception P!blic 'oolean pre+io! >? thro% S@;E/ception P!blic 'oolean #ir t >? thro% S@;E/ception P!blic 'oolean la t >? thro% S@;E/ception ACCESSING RESULTSET DATA@ Method name and *urpose #or thi inter#ace-
'ublic #oolean get #oolean (int i) *ets the data in the speci$ied column as a #oolean. 'ublic #oolean get #oolean (String col) 'ublic int get+nt (int +) *ets the data in the specied columns An int. 'ublic int get+nt (String col) 'ublic String get String (int +) as 'ublic String getString (String col) *ets the data in the specied column a string.
STATEMENT@
91
ATM Simulator The inter#ace ja+a- $l-Sta"ent i nor"ally ! ed #or endin& S@; tate"ent that do not ha+e IN or 6*T para"eter - The <D'C dri+er +endor pro+ide the i"ple"entation cla #or thi inter#ace- The co""on "ethod re$!ired by the di##erent <D'C tate"ent are de#ined in thi inter#ace- The "ethod de#ined by ja+a- $l- State"ent can be broadly cate&ori7ed a #ollo% J E/ec!tin& S@; tate"ent @!eryin& re !lt and re !lt et 0andlin& S@; batche 6ther "i cellaneo! "ethod The inter#ace ja+a- $l- tate"ent de#ine Method #or e/ec!tin& di##erent S@; tate"ent li)e SE;ECT( *PDATE( INSERT( DE;ETE( and CREATEP!blic Re !lt et e/ec!te @!ery > trin& $l? thro% S@;E/ception The #ollo%in& #i&!re ho% ho% the Dri+erMana&er( Dri+er( Connection( State"ent( Re !ltSet cla e are connectedDri+erMana&er
Dri+er
Connection
Prepared State"ent
State"ent
Callable State"ent
Re !lt Set
Re !lt Set
Re !lt Set
9.
ATM Simulator
THE NEED FOR !SP@ Ser+let are indeed ! e#!l( and <SP by no "ean "a)e the" ob olete- 0o%e+er( It i hard to %rite and "aintain the 0TM;No! cannot ! e tandard 0TM; tool The 0TM; i inacce ible to non1<a+a de+eloper -
BENEFITS OF !SP@ <SP pro+ide the #ollo%in& bene#it o+er er+let aloneJ It i ea ier to %rite and "aintain the 0TM;J In thi no e/tra bac) la he ( no do!ble $!ote ( and no l!r)in& <a+a ynta/No! can ! e tandard Web1 ite de+elop"ent tool J We ! e Macro"edia Drea"%ea+er #or "o t o# the <SP pa&e - E+en 0TM; tool that )no% nothin& abo!t <SP can ! ed beca! e they i"ply i&nore the <SP ta& No! can di+ide !p yo!r de+elop"ent tea"J The <a+a pro&ra""er can %or) on the dyna"ic code- The Web de+eloper can concatenate on the repre entation layer- 6n lar&e project ( thi di+i ion i +ery i"portant- Dependin& on the i7e o# yo!r tea" and the co"ple/ity o#
93
ATM Simulator yo!r project( yo! can en#orce a %ea)er or tron&er eparation bet%een the tatic 0TM; and the dyna"ic contentCREATING TEMPLATE TEMT@ A lar&e percenta&e o# o!r <SP doc!"ent con i t o# tatic te/t )no%n a te"plate te/t- In al"o t all re pect ( thi 0TM; loo) j! t li)e nor"al 0TM; #ollo% all the a"e ynta/ r!le ( and i"ply pa ed thro!&h to that client by the er+let created to handle the pa&e- Not only doe the 0TM; loo) nor"al( it can be created by %hate+er tool yo! already are ! in& #or b!ildin& Web pa&e There are t%o "inor e/ception to the te"plate te/t pa ed thro!&h r!le- 2ir t( i# yo! %ant to ha+e PS Ar SQ in the o!t port( yo! need to p!t PYS or SYQ in the te"plate te/t- Second( i# yo! %ant a co""on to appear in the <SP pa&e b!t not in the re !ltant doc!"ent( PS11 <SP Co""ent 11 SQ 0TM; co""ent o# the #or"J PZ[0TM; Co""ent 11Q are pa ed thro!&h to the client nor"ally-
TYPES OF !SP SCRIPTING ELEMENTS@ <SP criptin& ele"ent allo% yo! to in ert <a+a code into the er+let that %ill be &enerated #ro" the <SP pa&e- There are three #or" J 1- E?;r,--io6- o# the #or" PSR<a+a E/pre ion SQ( %hich are e+al!ated and in erted into the er+letF o!tp!t.- S5i;tl,t- o# the #or" PS<a+a code SQ( %hich are in erted into the er+letF Lj pSer+ice "ethod >called by er+ice?3- D,5laratio6- o# the #or"PSZ 2ield,Method Declaration SQ( %hich are in erted into the body o# the er+let cla ( o!t ide any e/i tin& "ethod -
94
ATM Simulator
USING !SP EMPRESSIONS@ A <SP ele"ent i ! ed to in ert +al!e directly into the o!tp!t- It ha the #ollo%in& #or"J PSR <a+a E/pre ion SQ The e/pre ion i e+al!ated( con+erted to a trin&( and in erted in the pa&e- Thi e+al!ation i per#or"ed at r!nti"e >%hen the pa&e i re$!e ted? and th! ha #!ll acce to the in#or"ation abo!t the re$!e t- 2or e/a"ple( the #ollo%in& ho% the date,ti"e that the pa&e %a re$!e tedC!rrent ti"eJ PSRne% ja+a-!til-Date >? SQ
PREDEFINED >ARIABLES@ To i"pli#y e/pre ion %e can ! e a n!"ber o# prede#ined +ariable >or i"plicit object ?- The pecialty o# the e +ariable i that( the y te" i"ple tell %hat na"e it %ill ! e #or the local +ariable in Lj pSer+ice-The "o t i"portant one o# the e areJ R,Au,-t( the 0ttpSer+letRe$!e tR,-;o6-,( the 0ttpSer+letRe pon e-,--io61 the 0ttpSe ion a ociated %ith the re$!e t Out1 the %riter ! ed to end o!tp!t to client A;;li5atio61 the Ser+letConte/t- Thi i a data tr!ct!re hared by all er+let and <SP pa&e in the %eb application and i &ood #or torin& hared data0ere i an e/a"pleJ No!r ho tna"eJ PSR r,Au,-t.&etRe"ote0o t >? SQ COMPARING SER>LETS TO !SP PAGES
99
ATM Simulator
<SP %or) be t %hen the tr!ct!re o# the 0TM; pa&e i #i/ed b!t the +al!e at +ario! place need to be co"p!ted dyna"ically- I# the tr!ct!re o# the pa&e i dyna"ic( <SP i le bene#icial- So"e ti"e er+let are better in !ch a ca e- I# the pa&e con i t o# binary data or ha little tatic content( er+let are clearly !perior- So"eti"e the an %er i neither er+let nor <SP alone( b!t rather a co"bination o# bothRITING SCRIPTLETS I# yo! %ant to do o"ethin& "ore co"ple/ than o!tp!t the +al!e o# a i"ple
e/pre ion -<SP criptlet let yo! in ert arbitrary code into the er+letF "ethod- Scriptlet ha+e the #ollo%in& #or"J PS <a+a code SQ Scriptlet ha+e acce
Lj pSer+ice
>re$!e t( re pon e( e ion( o!t ( etc ? -So #or e/a"ple yo! %ant to e/plicitly end o!tp!t o# the re !ltant pa&e ( yo! co!ld ! e the o!t +ariable ( a in the #ollo%in& e/a"pleJ PS Strin& $!eryData R re$!e t-&et@!eryStrin& >?T o!t-println >Attached EET dataJ H $!eryData?T SQ SCRIPTLET EMAMPLE@ A an e/a"ple o# code that i too co"ple/ #or a <SP e/pre ion alone( a <SP pa&e that ! e the b&Color re$!e t para"eter to et the bac)&ro!nd color o# the pa&e -Si"ply ! in& P'6DN 'EC6;6RRPSR re$!e t-&etPara"eter >b&color? SQ Q Wo!ld +iolate the cardinal r!le o# readin& #or" dataUSING DECLARATIONS A <SP declaration let yo! de#ine "ethod or #ield that &et in erted into the "ain body o# the er+let cla -A declaration ha the #ollo%in& #or"J
9C
ATM Simulator PSZ 2ield or Method De#inition SQ Since declaration do not &enerate o!tp!t( they are nor"ally ! ed in conj!nction %ith <SP e/pre ion or criptlet - In principle( <SP declaration +ariable? de#inition ( "ethod de#inition ( inner cla bloc) J anythin& that i le&al to p!t in ide a cla can contain #ield >in tance de#inition ( or e+en tatic initiali7er de#inition b!t o!t ide any e/i tin&
"ethod - In practice declaration al"o t al%ay contain #ield or "ethod de#inition We ho!ld not ! e <SP declaration to o+erride the tandard er+let li#e cycle "ethod The er+let into %hich the <SP pa&e &et tran lated already "a)e ! e o# the e "ethod There i no need #or declaration to &ain acce to er+ice( do&et( or depo it( ince call to er+ice are a!to"atically di patched to Lj pSer+ice( %hich i %here code re !ltin& #ro" e/pre ion and criptlet i p!t- 0o%e+er #or initiali7ation and clean!p( %e can ! e j pInit and j pDe troy1 the tandard init and de troy "ethod are &!aranteed to call the e "ethod in the er+let that co"e #ro" <SP-
%.' !AKARTA TOMCAT To"cat i the Ser+let,<SP container- To"cat i"ple"ent the Ser+let .-4 and <a+aSer+er Pa&e .-A peci#ication- It al o incl!de "any additional #eat!re that "a)e it a ! e#!l plat#or" #or de+elopin& and deployin& %eb application and %eb er+ice TERMINOLOGY@ Conte/t : a Conte/t i a %eb application\CATA;INAL06ME : Thi repre ent the root o# To"cat in tallationDIRECTORIES AND FILES@
9B
ATM Simulator D<i6 : Start!p( h!tdo%n( and other cript - The ]- h #ile >#or *NIO are #!nctional d!plicate o# the ]-bat #ile >#or Windo% co""and1line lac) certain #!nctionality( there are o"e additional #ile in hereD5o69 C Con#i&!ration #ile and related DTD - The "o t i"portant #ile in here i er+er-/"l- It i the "ain con#i&!ration #ile #or the containerDlo7- C ;o& #ile are here by de#a!ltD3,<a;;- C Thi i %here %ebapp &oY INSTALLATION@ To"cat %ill operate !nder any <a+a De+elop"ent Mit ><DM? en+iron"ent that pro+ide a <DM 1-. >al o )no%n a <a+a. Standard Edition( or <.SE? or later plat#or"- <DM i needed o that er+let ( other cla e ( and <SP pa&e can be co"piledy te" ?
EB APPLICATION@
HTML a6. !SP Fil, Main ;ocation \CATA;INAL06ME,%ebapp ,R66T Corre pondin& *R; http,--host-Some!ile.html http,--host-Some!ile..sp ore Speci$ic Location (Arbitrary Subdirectory). 9D
Individual Servlet and Utility Class ,iles ain Location (0lasses 5ithout 'ac7ages). /0A&AL+1A234 "-5ebapps-644&-8"#9+1!-classes 0orresponding U6L (Ser:lets). http,--host-ser:let-Ser:let1ame ore Speci$ic Location (0lasses in 'ac7ages). /0A&AL+1A234 "-5ebapps-644&-8"#9+1!-classes-pac7age1ame 0orresponding U6L (Ser:lets in 'ac7ages). http,--host-ser:let-pac7age1ame.Ser:let1ame
Servlet and Utility Class ,iles Bundled in 3'4 ,iles Location /0A&AL+1A234 "-5ebapps-644&-8"#9+1!-lib 0orresponding U6Ls (Ser:lets) http,--host-ser:let-Ser:let1ame http,--host-ser:let-pac7age1ame.Ser:let1ame
9G
ATM Simulator
C4a;t,r /)
TESTING
) .SOFT
T,-ti67 So#t%are te tin& i a critical ele"ent o# o#t%are $!ality a !rance and repre ent the !lti"ate re+ie% o# peci#ication( de i&n and code &eneration.
ARE TESTING
CA
ATM Simulator To en !re that d!rin& operation the peci#icationT6 "a)e !re that y te" "eet the ! er re$!ire"ent d!rin& operation To "a)e !re that d!rin& the operation( incorrect inp!t( proce in& and o!tp!t %ill be detected A &ood te t ca e i one that ha a hi&h probability o# #indin& an a yet !ndi co+ered error The o#t%are de+eloped ha been te ted !cce #!lly ! in& the #ollo%in& te tin& trate&ie and any error that are enco!ntered are corrected and a&ain the part o# the pro&ra" or the proced!re or #!nction i p!t to te tin& !ntil all the error are re"o+ed- A !cce #!l te t i one that !nco+er an a yet !ndi co+ered errorNote that the re !lt o# the y te" te tin& %ill pro+e that the y te" i %or)in& correctly- It %ill &i+e con#idence to y te" de i&ner( ! er o# the y te"( pre+ent #r! tration d!rin& i"ple"entation proce ).+ TEST CASE DESIGN@ 4it, <o? t,-ti67 White bo/ te tin& i a te tin& ca e de i&n "ethod that ! e the control tr!ct!re o# the proced!re de i&n to deri+e te t ca e - All independent path in a "od!le are e/erci ed at lea t once( all lo&ical deci ion are e/erci ed at once( e/ec!te all loop at bo!ndarie and %ithin their operational bo!nd e/erci e internal data tr!ct!re to en !re their +alidity- 0ere the c! to"er i &i+en three chance to enter a +alid choice o!t o# the &i+en "en!- A#ter %hich the control e/it the c!rrent "en!etc-( y te" %ill per#or" a per
C1
ATM Simulator
Bla5J Bo? T,-ti67 'lac) 'o/ Te tin& atte"pt to #ind error in #ollo%in& area or cate&orie ( incorrect or "i in& #!nction ( inter#ace error( error beco"e a +alid entryThe #ollo%in& are the di##erent te t at +ario! le+el J U6it T,-ti67@ *nit te tin& i e entially #or the +eri#ication o# the code prod!ced d!rin& the codin& pha e and the &oal i te t the internal lo&ic o# the "od!le,pro&ra"- In the Eeneric code project( the !nit te tin& i done d!rin& codin& pha e o# data entry #or" %hether the #!nction are %or)in& properly or not- In thi pha e all the dri+er are te ted they are ri&htly connected or notin data tr!ct!re ( per#or"ance error initiali7ation and ter"ination error- 0ere all the inp!t data "! t "atch the data type to
I6t,7ratio6 T,-ti67@ All the te ted "od!le are co"bined into !b y te" ( %hich are then te tedThe &oal i to ee i# the "od!le are properly inte&rated( and the e"pha i bein& on the te tin& inter#ace bet%een the "od!le - In the &eneric code inte&ration te tin& i done "ainly on table creation "od!le and in ertion "od!le>ali.atio6 T,-ti67 Thi te tin& concentrate on con#ir"in& that the o#t%are i error1#ree in all re pect - All the peci#ied +alidation are +eri#ied and the o#t%are i de i&ned #ro" the peci#icationT they are li ted o!t and are correctedSy-t,m T,-ti67 !bjected to hard1 core te tin&- It al o ai" at deter"inin& the de&ree o# de+iation that e/i t in the o#t%are
C.
ATM Simulator Thi te tin& i a erie o# di##erent te t %ho e pri"ary i to #!lly e/erci e the co"p!ter1ba ed y te"- Thi in+ol+e J I"ple"entin& the y te" in a i"!lated prod!ction en+iron"ent and te tin& itIntrod!cin& error and te tin& #or error handlin&-
TEST CASES
T,-t Ca-, 9or >,ri9yi67 Aut4,6ti5atio6@
C3
ATM Simulator
T,-t 5a-, &@ =eri#yin& A!thentication. T,-t O<N,5ti8,@ 2or =eri#yin& A!thentication.
T,-t D,-5ri;tio6@ * er enter Card N!"ber and pa %ord( pre e !b"it b!tton( client pro&ra" contact %ith er+er( er+er contact %ith the databa e( databa e chec) #or a!thentication and end re !lt a a +alid ! erR,Auir,m,6t- >,ri9i,.@ Ne T,-t E68iro6m,6t@ Apache to"cat er+er "! t be in r!nnin& tate( Databa e Sho!ld contain appropriate table and lin) "! t be e tabli hed bet%een er+er and client pro&ra"T,-t S,tu;DPr,/Co6.itio6-@ Apache er+er ho!ld be in r!nnin& tate- Card N!"ber and Pa %ord #ield ho!ld be enteredA5tio6E?;,5t,. R,-ult-
The ! er %ill elect !b"it b!tton to acce Di play Main Men!applicationPa--@ Y,Co6.itio6- ;a--@ Y,FailJ No Pro<l,m- D I--u,-@ NI; Not,-J S!cce #!lly E/ec!ted
C4
ATM Simulator
T,-t 5a-, &@ Withdra%al o# Money Priority "H1 L(@ 3igh T,-t 5a-, &@ Depo itin& Money Priority "H1 L(@ 3igh T,-t O<N,5ti8,@ 2or Withdra%al o# MoneyT,-t O<N,5ti8,@ 2or Depo itin& %ithdra%al Money- a"o!nt( pre e Withdra% b!tton( client pro&ra" contact D,-5ri;tio6@ * er enter %ith er+er( er+er * contact %ithdepo the databa e( &et the acco!nt detail balance detail proce onclient it and T,-t D,-5ri;tio6@ er enter it a"o!nt( deno"ination and pre ( per#or" e Depo it b!tton( tore the detail in the corre pondin& table pro&ra" contact %ith er+er( er+er contact %ith the databa e( detail %ill be tored in the databa eR,Auir,m,6tR,Auir,m,6t- >,ri9i,.@ >,ri9i,.@ Ne Ne T,-t T,-t E68iro6m,6t@ E68iro6m,6t@ Apache Apache to"cat to"cat er+er er+er "! "! t t be be in in r!nnin& r!nnin& tate( tate( Databa Databa e e Sho!ld Sho!ld contain contain appropriate appropriate table and lin) "! t be e tabli hed bet%een er+er and client pro&ra"table and lin) "! t be e tabli hed bet%een er+er and client pro&ra"T,-t T,-t S,tu;DPr,/Co6.itio6-@ S,tu;DPr,/Co6.itio6-@ Apache Apache er+er er+er ho!ld ho!ld be be in in r!nnin& r!nnin& tatetate- All All the the #ield #ield "! "! t t be be enteredentered* er M! t be lo&&ed in* er M! t be lo&&ed inA5tio6A5tio6E?;,5t,. E?;,5t,. R,-ultR,-ult-
* a"o!nt( pre e Withdra% Di action been co"pleted* er er enter enter %ithdra%al depo it a"o!nt( deno"ination detail Di play play No!r S!cceTran #!lly Depoha itedb!tton and pre e Depo it b!ttonPa--@ Co6.itio6Fail Pa--@ Y,Y,Co6.itio6- ;a--@ ;a--@ Y,Y,FailJ J No No Pro<l,mPro<l,m- D D I--u,-@ I--u,-@ NI; NI; Not,Not,-J J S!cce S!cce #!lly #!lly E/ec!ted E/ec!ted
it4.ra3al o9 Mo6,y@
C9
ATM Simulator @ T,-t 5a-, &@ 'alance En$!iry T,-t O<N,5ti8,@ 2or 'alance En$!iryT,-t D,-5ri;tio6@ * er pre e 'alance En$!iry b!tton( client pro&ra" contact %ith er+er( er+er contact %ith the databa e( &et the acco!nt balance detail #ro" the corre pondin& table R,Auir,m,6t- >,ri9i,.@ Ne T,-t E68iro6m,6t@ Apache to"cat er+er "! t be in r!nnin& tate( Databa e Sho!ld contain appropriate table and lin) "! t be e tabli hed bet%een er+er and client pro&ra"T,-t S,tu;DPr,/Co6.itio6-@ Apache er+er ho!ld be in r!nnin& tate- * er M! t be lo&&ed inA5tio6E?;,5t,. R,-ult-
* er pre e 'alance En$!iry b!tton Pa--@ Y,Pro<l,m- D I--u,-@ NI; Not,-J S!cce #!lly E/ec!ted
CC
ATM Simulator
T,-t 5a-, &@ Mini State"ent T,-t O<N,5ti8,@ 2or Mini State"ent
T,-t D,-5ri;tio6@ * er pre e on Mini State"ent b!tton( client pro&ra" contact %ith er+er( er+er contact %ith the databa e( &et the acco!nt balance detail alon& %ith the %ithdra%al and depo it detail #ro" the corre pondin& table R,Auir,m,6t- >,ri9i,.@ Ne T,-t E68iro6m,6t@ Apache to"cat er+er "! t be in r!nnin& tate( Databa e Sho!ld contain appropriate table and lin) "! t be e tabli hed bet%een er+er and client pro&ra"T,-t S,tu;DPr,/Co6.itio6-@ Apache er+er ho!ld be in r!nnin& tate- * er M! t be lo&&ed inA5tio6E?;,5t,. R,-ult-
* er pre e on Mini State"ent b!ttonPa--@ Y,Pro<l,m- D I--u,-@ NI; Not,-J S!cce #!lly E/ec!ted
CB
ATM Simulator
C4a;t,r /=
CD
ATM Simulator
CG
ATM Simulator
BA
ATM Simulator
T4i- ;a7, 3ill <, .i-;lay,. 34,6 u-,r ty;,- ro67 ;a--3or. i6 t4, 3ro67 ;a--3or. 9i,l.
T4, 9ollo3i67 ;a7, 3ill <, .i-;lay,. 34,6 t4, u-,r 54a67,- 4i- ;a--3or.
B1
ATM Simulator
T4i- ;a7, 3ill <, .i-;lay,. 34,6 u-,r ,6t,r- 3ro67 amou6t
B.
ATM Simulator
T4i- Pa7, 3ill <, .i-;lay,. 34,6 u-,r ,6t,r mor, t4a6 ;r,-5ri<,. amou6t
T4i- ;a7, 3ill <, .i-;lay,. 34,6 u-,r ,6t,r 5orr,5t amou6t "i.,.1 multi;l,- o9 &##( A6. ;r,--,. -u<mit <utto6.
B3
ATM Simulator
It 3ill <, .i-;lay,. 34,6 u-,r tri,- to 7,t mor, t4a6 ;r,-5ri<,. amou6t o6 t4, -am, Day
T4i- ;a7, 3ill <, .i-;lay,. 34,6 u-,r 5li5J- o6 D,;o-it O;tio6
B4
ATM Simulator
T4, 9ollo3i67 ;a7, 3ill <, .i-;lay,. 34,6 u-,r 5li5J- o6 .,6omi6at, <utto6
Di-;lay,. 34,6 u-,r E6t,r No. o9 &##O- a6. 5li5J- o6 N,?t <utto6 i6 t4, ;r,8iouS5r,,6 B9
ATM Simulator
It 3ill <, .i-;lay,. 34,6 u-,r ,6t,r- No. o9 '##O- a6. ;r,--,- N,?t <utto6
It 3ill <, .i-;lay,. 34,6 u-,r ,6t,r- No. o9 &##O- a6. ;r,--,- N,?t <utto6
BC
ATM Simulator
T4i- ;a7, 3ill <, .i-;lay,. 34,6 u-,r 5li5J- o6 D,;o-it <utto6 i6 t4, ;r,8iou-5r,,6
BB
ATM Simulator
BD
ATM Simulator T4i- Pa7, 3ill <, .i-;lay,. a9t,r t4, ;r,8iou- ;a7,
T4i- Pa7, 3ill <, .i-;lay,. 34,6 u-,r 5li5J- o6 Bala65, E6Auiry
BG
ATM Simulator 4,6 U-,r 5li5J- o6 Pri6t <utto6 it 3ill <, .i-;lay,.
C4a;t,r / $ CONCLUSION
The ATM Simulator project ha been !cce #!lly co"pleted- The &oal o# the y te" i achie+ed and the proble" are ol+ed- Thi project i de+eloped in thi "anner that i ! er #riendly and re$!ired help i pro+ided at di##erent le+el The pri"ary objecti+e i to pro+ide the interacti+e er+ice to all the * er - Di##erent type o# er+ice are pro+ided to both the ad"in and ! er - * er can a+ail thi er+ice any ti"e-
APPENDIM
ABBRE>ATIONS@ 0TM;J 0yper te/t "ar) !p lan&!a&e<SCRIPTJ ja+a cript
DA
ATM Simulator
DFD@ Data Flo3 Dia7ram-
0TTPJ 0yper Te/t Tran #er Protocol <D'CJ <a+a Data 'a e Connecti+ity. FABOS 4at i- Na8a -5ri;tP
!a8a -5ri;t i- a 5om;a5tQ o<N,5t <a-,. -5ri;ti67 la67ua7, 9or .,8,lo;i67 5li,6t a6. -,r8,r i6t,r6,t a;;li5atio6-.
4,r, 5a6 H-5ri;tI 5o6tai6,r ta7- <, ;la5,. 3it4 i6 a6 4tml .o5um,6tP
In &eneral( the P criptQ container ta& "ay appear any %here %ith in the ht"l doc!"ent- It i "ore +iable to ha+e the ta& placed %ith in the PheadQ container-
A.8a65,. !a8a Pro7rammi67 Ma-t,ri67 !A>A + !a8a S,r8,r Pro7rammi67 So9t3ar, E67i6,,ri67
Web ite
D1
D.