Advance Java - Notes
Advance Java - Notes
J:44
Adyongava
TOk
IRE iollled JRE
0fhoa AoHuia
3DB
diive Div
My&sl
6vacde pp D8
Hoo ale JDBC applied?
aie 15
in Jovm o TARS
JDB C dive plalho dspecihie
3DD App Independen
t0hen change Dadalast JpB doiver chang
JDBDnVeY my s0
Dalabase
gelConnechion ( Ul , Uy Podwond)
Synlax IDB(UR
kno (DARrdpao o1C)
lat
3DB UR Aynlax jdbc:aubprotood; 5ubnam
9 jdbe:mysql: /
:34
DB elahd InShauctron
Cs0gte dobas. uh beam21;
(eale dala base
Use Aun bea m2l1
n= =null)
Managrs,g-ltonnecton nl,"yool, 'marg,:
Cn
=Drivs
efusn Cn
dacs
Java Crnal Gtaement() hootes COL fxcephien
Rebunns- enpy toraa
Dtoplay onJava
8st talsh menf
main){
y(Co nnudion n= fsleh (onnco(
Javadocs Ink»faa Stakmen) ut Closob.
Stakmenl
(eft mpty 6lah me ntA ry
shakmds - Cn. cealh Shahoenl( )) _
Xeuut
Cure uery () et cut Upda
Cieate fa l
stoord
Daselec) DD Prt ceceuv
DmIn/0JD
Cws0y 0 2xtcr ue
posifioped
behi rosl 00
Cusoq- Yow
Nesl9 mOre cs0s to hext
nOSeicoh
Krsult Sd Do0texing
9 Kesa l lAef
gead Columns
de
How fo
Gel gel1yp(inlcallfs),ho De
publhe (ly (Sring lolName)
DB
T y p 3 indeprnden e DB
eDeyic S0L
o n v e Alon
numbrs (m,n)
foal/dabl
java. q!.dr
dale
Hme
Ime s/amp Charechv
meshamp A va. eqlclhb
clob Birey lange Oby
blob jaua. 5q1. Blob
Addsess
Ayotrm.od.pmalf("Emp id d Name %s
Y.1-2j. Depl 5 jonid tn% ( -
1s1gel ni(),7sd. lgul Shing a), yst .
AS: 17 inporton
Iu/20
Infesad main amt
Only 1mpkmunll dhonges
Emain Same-
p e CS
(enad-/ay4)
SDBC Dive Type
Disedonlaq phlfom dependan ce
Dilfrenl lype JDBC Daivei 1s/pl20-> 3)
(3)utnyxecuho0n
Dld hm
Reaull seh 1st Sh.exeuh Gury (q1);
4) RSI> in memcy virns ) Dle chd voics and cclu
6 Autydoobl 1ssln
and Jcin.dah bl
yyy9-tm]m -Ta]d
Cueny Xtcuhion ex&un method
Publie Rrauloelt Poepad Slakmn
public Rraul e ( Shing sq1)
Slakmn
S o
u h M D -
ry (Rroul el Tsl psl. ehe Cude dueg()
a o p e rveoult lohile st. DexlDg
e t yso( Emp id 1d
"
Name 5 dakay, ot.qettn
161.ge1shinql2), vetqd Dak (4), 1s) 9eDo ulh ( D
Ghing sql = h
6cled hpre, ame,sd,) Da
(? and jon tal bla(2)an
O7 and DRT a tnrced sapesak-
Aqest el ai chi hokr»
elalh Dalakase> Tabls, 100s, columny primay hey
No syl dalahar
DES my. emp -> t0}ll br epnsenhd as clas n jav
ORm hibrna
RDBM
Java objec
bpch wrtH Re lolh oB
DB Table
pojo domey
Tobl. Column
Pojo prophi
To ble ouws
poj0s
uniqur 1d ptpshy y key
pDoplant cld )a va
Vanila fla Vousd (no fHavous)
Odinauy_ohyd (plane objcl) 21
no busne logjc, j usi plane
layesed a rchiteetan
DelTI kayr (r1s laye)
DB Layt Tobles /0ws/co laumn
e Hens d eHrs
3
ala ac(em Layt
DAOlaye Moming Itmployer De
SRinleyau
add me fd dhelna tin fhs guhing oehchd
tnipley
Olayry DaBa boe (my tmp)
PT Fnployre
3Hant e TDB DAO Melkods o Dno
31Tnfaface
Geting sekdhd method na me
A i emp> gelsuehl Empo( Shing dept, shing sl,tah
Shing end Dah) hood's
(DT0-2 dola homfs obyd
qelgel selechd tm
?
e plaaheldey paramahr pesthe
psll. 6elshnq (ídepl)
psll Doh (a, Dakvalurc (stiDok
pol 8el Da 3, Dok 1olurof (erd Dl)
(taeeudr uey
Rrauull oek >>m hed loml
Nriabl.
ny(Re sul sd sl- pst orcuh Qurnyl))
while (7st. neal ())i Resull Sel Viro)
adding
Enploye
tmps.add ((nru Enrp(sh.ge!n!(1).7sl.qulShingla),
t o c o l l e c h i o n
tmploye DaOimpl da o
e
= ntw fmpkyir Dao Impl(),
23
Clienl equesh 6envic/ng phosr
dypo (Enhy deph stautdak, end dak);
dao,qeloe lechd Emplo y (sc.ne xi() ,5t DExt (O,a Dexl) . fo
Each (oyoho) oud =pnilln)
Cleanup
TeslAaye Hpp G
Ucl copted eatli tolh
cloat pot2
public shtnq add fmpD.kik (Employe t Dto Emp) thoouns ?33
S6L Excephen
psha. el ohing (, nroEmp qutName O)
el Shing( 2, qef ncdrtm ())
e l Doubl(3, gtt oalau »)
Deptha );)
1oinDahC)
u xeqdion Xecu Updah ();
DpL
)einf xecuh Updale (Ghing ql);
4novoo
pdale inl execub Updale ()
AS tqn mern
E
0lVeTeoer - DAO(/ , implclan) - -- DBuils -
Topls pa
na me
Get Al available 1pic
skp1- Tabl
pojo Tople
3 DAO
(neo A, J1opicDa d
51 Stoang 5/Lisl ZTepts> gel AUTepi% ()
4)Inmpl a psli:Aeleck Gunty
(9 Toin 9uey
De Table)fuhth
Pc70-fulerial
prtperhe:
OA6: f kisf ááhtnq> qel htralByTepicNome(5hing epjch.
Imp Cla) Alecl tn join dn topics G tuh io
nlpecihe tuhnal details
Conlen Vanchay 15000
p tutosial d i u a l
Keqishering
euste qef EAVE Muot
DB
param
DBC Java(TVm)
1nerm mo IDB ypr
Sava do Colla be ShtemeDl
IDBC Typesjava. sql. types
Deuble gk
Kqio terinq pavam9 a , Typea. Deublh),
5, Typo Deublr),
e q1shroul pasam
311.7tgsh OulPasaohs ( 4, Type. Deu bl)
(311 egish Oul hramrhs/ 5, Type) Doubl)
IN t t valu mles
n/od/nal pa
vo
Out Req1shr ih
üih J
JpBC fup
TDB Y JYM
Trnoal Boh
tohen to use 7n/tul/Zn0owl
In CRUD m theds (5eavia)
Execud Goed pro ce du
(GI. exe cuh ();
Read Resull hom Oul Pavams-
Rehive he toul otoved
In d pavam
a1amefry 1nder
APZ (6T
public Type get Typt(int'.)throws
on Fxtat
e7e hun
hun updahd sre oalana " (sl.get Deuble (
Owt paia mh Pos
det balant "t cstl. qel
Doubl. (5):
=b0itn.qelA{Hibute (" aoeo.dtis") L S
=EAÍ tn.&lA{zibute ("Dm", 1234) blo
Rufs hul
align-"(enhei "Atyk "cebr; ved"s sesoion zd:,<Ihs>
=
= = ssion.qelldO
Inmplicibly
dessit n a added
Zhs> Reques Poyameey Via 3sp ExpnlieD2o t con wwt died
Zhs> Helle, 2). =
ieques!.pavame tr( "name")
xpenion Janguagt 3ynta
noplhidl obye d-9 Canba asesed enly h
ipleb n expresio ns
Imphat obje ch ->
dccesilblk b FL ayntax 1...3)
yntax (Exprsionhe
4expr t evalaah 2 h br added in Bedy
anslare to sbing. send i h dnl Bro@ser
Indude slthaio
add tul. flosh ; 9 Mffs Commilhng he) alla w
im KToill be heatcl as
athibudh
Yche cks in all }he maps
OWe peotomanuillbt blank
10aingjava cocds Stipll
to ge parame El synta
Detault Ac0 pe p fe
=
35P xpvEmiOn
Yo =btmion.gelld O7%7
cookie EL Auntax
Via
4Umien.id?. X
9 paq Contxt, otmlon: id? - -
- paqeontxlgdsimion)gelid/)dun
to dien)
5P (xprMMN
wion= Hüpórmion ( Hipts jsp (xpresnen)
= Btslen.q:Aikde(nm")"1
fl ynla
6estngapr. nm3 03 4 nm3
URL Rewrilhng
In dient pul Corklen as dioabl.d
DayI erbapp -» Indes ths> Tshng UR: Rrgri ling<a ta "hshjep'>
Copy Aogin jsp tstm pn vit
Ttst.15p (dienl
nds oeme m bey hts afthr)
Reaspenge: pubhe Void 'enced Pd
/l mehad e/ npSnvhl
por
Ysponot.8tn Redyd(op. encod. Kche
Ceuteg
D e n t u
URL (" fet2. jsp"),
d
Teot2_15 a bnfe (Y,= 3speha.enccde URL( "hsl3 j9p"), 2.
a
ht)= 2% = ud 7. > Lct m Cuk <le>
nd t End Encsyption (tips)
(Co kie alt darcked tnude URL
lagr dediv
Comma nda/ mesmoqes tor Jsp lrgine (= Tsp ainainty w)
=
Tranolahon time
aynlax Y, @
(Pagedluchvr /| ammohd applitable to pgt dy
I'mpo umma sepe vahd Aiot
atssion boolean a toibut delaculd:bu
To dioabl t 831on baking ,apreity orsion: "faloe "
"URz 0 hardliny")
tello 0 t b taad uoes h en handhr pa
ndex-]5P:. a t) t stu 4s pa>
Ten-js?
(21. pog N
or
pagt: "my_evv hondkr jsp ( )
o
0
y
n
7
ho n
.
C) head>
body>
C7, Shihg Meoq"hela
oC invok -
1d. vd frwwd.
ndex hinq_frtsad_achon
TcolT hveesl7.159 9pid =10lq nane
manqoapae
dtst115P hs in frnd page
WOeah pnducd pej0 n add il in a
ouita h Gcope
Trs.)ep" />
Tesl 8.5P =<Bcdy
Dodud Delails: 5 podud _dfb?
ques sap. predud.dfls?
hs Pnom. 42
pasanmap 1qutst PoPorometeg
map vquns
1n cludr 5cen uo
ksp nclud page "eyRisp /> "
Adrin t cane o Veky
(ustDelails ==nul)2nvalid
ithusn login",
Yerdm check Hh o/
if (uor Deldl. gel Role (). tquals("admin')) g
7ehunn admin
Usrs Delailo issake (0)
Tehuvn" log bul"
yeun"Candidade_ iol
5P ebtan id: 'beanid dan "fully &ualifird bran
cam name"
opt" page, «queoi l6emion )applican /> ,
hul
btan dnen1) exis) altady eXB}
Asion..0tdAHvikuh |"Ve tzy", Dr VohyBranl))
Changr t
Valhdak 9p 2 Bedys TspBean tnhe In inne Map
Hoo fo invo ke JayaBeans 13.L uoeing El Synk
uxy.esDeail.name
hs> fesion Supe
ipagelornkxl, sesien.InVaida (3
nvai dating
Poo naetre n in
Rediveh
Conl
Valida f- 21sp f
4ing JSTL
w e taglib dinechve h mpe/ TSTL taglibay
Aynlas Llaqub U7i-"ORTQ 1s1 tog Ub" prehx-"tagpo
lag pyehx""
C Tedined ul 6smicn&pt.mq benk. dee Plecouot(O3"/>.
dend sidec
+
tnlude yedinedl tmbd n Cn JsFSSJON)
Validah 1sP pa gt 7
d a y o v d i a na
Clonin
@OYeid
Pablhe Sudent dene() hroos den Not supposhd faception
7thon (oludend)