0 ratings 0% found this document useful (0 votes) 12 views 49 pages Adv. Java-Notes
The document discusses various aspects of database connectivity, including JDBC drivers and their types, such as Type 1, Type 2, Type 3, and Type 4 drivers. It outlines the advantages and disadvantages of each driver type, emphasizing the importance of proper installation and configuration for optimal performance. Additionally, it touches on the use of prepared statements and the execution of SQL commands within Java applications.
AI-enhanced title and description
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here .
Available Formats
Download as PDF or read online on Scribd
Go to previous items Go to next items
Save ADV. JAVA-NOTES For Later A aminotes
TA
av
JASEe —-
JaEE 7 Towa ad Entenpuue Edition
IAHE 4 Hobile Edition
TaEE
‘) RHI
+) Ippge ;
_)Taue Dotobase con necti ui
“) Serudet He
‘)_asP_[ Jaua server p 1)
‘) Eg8 C Enterprise FE
o) Skvute
# Litenpcle 5 Tnveod +
unit () Jnitialzation
stant L)
—xunt) vunny
destroy oO bes le
wait D
deep (>
duupend oOA.arminotes
———!)_vaxiable become: tovutant. a __
——)__Hetnod_dloer_mnot_dJmhexit. “ —
AU Telouer a fn Town ose under Object the
— i
ed _dhould be declared os public. —
4 Antestnse (not deyfned metinogs)
AIR era ad ty Lr plement ____. =
gupta Tp Rite ied Bale
Aocelib Ae aAarminotes _
?
wsithgn the sub- claus | yer
Unyide xhe same package ce -
outalde the package - Nb No No Yes
No No, Yeu Yeu
Within dhe tub-clos
oud cide the package
+ Abstvoct Class
con_be
fibstract clos tonmot be vrutandiated , but th
tub Uossed. shen an abstvact Class ds 4b assed, the
_ webclose UW. rr hed Umplem entation: pe au q
tne abstvact niethod sin iu parent class. foweuer dif 4
doer not, then tne sub Cars aut uo be declared
ardtyock .
\olol 2
YEE arch
a- Tier
a
Benin) Requak .-——1
pl da tole
top Resporue eS
Prexutot-|A.arminotes
® A gece > Uvex publication wuyws: Rosetndio. com
Novers protection ont
NS
“ss
wT
O..8.
ALLNS
44.4944
H
|
|
a4,
ii gs eek 2
fT ep pelita tien Sea ae
ela
J aiff lwo Web ceruer and Apputcaction Seruer
Cals i
e . : — Cla tooo. Connecti
—_—_ i Coantten inc).
ar
an
oS Ssaim Rin... a sv — = :A aminotes
ova - Sy *
Tova. gl #5 Donnectim oot 5
edn re
Cad vanue
qpgc Wi an Apt specifications deueloped b Jun Hicagy? fe
that defines a uniform inteyace jew Beak i vaxious YClatia
dato ares .
grec driver transtates Wandard g28c cals into a network o
dotobae protowl or in a database Ubvary ints APL
cau. that facilitates mmunicakion with a “databbue- The
trantoio layer proues JDRC layer with data independe
ah Type 6 Driver?
bridge
) TdBC- ODBC, Driver or pe Aes
2).. Nokiue - API driver ow eA!
3). Network protownl driver dr eae
4). Pure Tava ov Thin driuer ov “Tipe a:A.arminotes
_ —TDBC.= Odbe badge dxiver or ett
: Dati
i iy Base ee
-Bduantoge-.2 ee re at
—Almogt_ ony databaue. for which edhe driver vit _sinutolled
Con _be_ aes atch
1) eoay bb ue - be oun wanecked te ony database i
me ==
_Pefformancd degraded became R&C method calli conuected
_dan the ODBC” function call - _£
2. The odbe needs tobe. Unutalled onthe Client machine
&
Ie 4, dxiven_tue the Sowa. Nablue Intupace (ani) make
cued t 0 local datohace Ubrantes . Thu “dyiuer — Lonuents
__ tthe TD8C_LaL_ints a dato, specific col. Ts du ier e
_tommunivtudivetly with the datobae server. ot requires
some mati. ve.cordto_tonnect to -the databoue.. Ty pe 2 dlvew
ite Native dotabeue client - Ubvories to: tne Boaiba 4
wojgoed © con Wenk machine. 2a Aarinotes
2 Belles pesarenane than T96¢ - Odbe beidge driuer.
The wotiue driver needs & be untalled en each client
machine.
2). Net all dlatalooses give the cient - ude Libyanes.
dal oll)»
aype 3 (Wetwsorle _protecol deduew) :+
: Town Application '
|
|
= Net ism won potoebt
Hiddle wore Svuer
ox ‘cohina Sever]
c
an
cba machine .
a). Thy dsuer eu adum in Jua 4 hence portable
and ib we suwitclble for the web .
3). The NU protocol be der ened fe make jhe Cenk
TRC dvuer _amall and ‘eut to
j
;
)
:
:
)
;
’
. Orig dour, M atruer fored go thee UY Wa- weed for
vender Olatabose library ty be presto oO the
load .
y Te ype anual typically prowide suport Pp featuresA.arminotes
—Such_os_ caching 4, lead ‘boJanchy 3 saduape esto ——
——edentniersatian 9 —such_or_Logi 5
4 als
4). Thy detuen te. sh es a Allow, a muta
—— databases ee Yome. 4 driver. -
——Pikadvanlage. 5 a: fle —
— rn 2 anpuicaton i dnstal 2
rol —_
——Trauerd ie - nay take. longer aince the
data _ to: nough the Upackeha “eruer.
ae Puse Town Driver)
lj pe Kien omni eto Liban. by Flee intraly.
7 ustth the daka base derue¥.
). The tran using += 4 dover arte at Bit i
+ Sno Sut ow f be achiewe _ ‘a
dndependence. + F elininatedeplapnent nna ecole =
Fe sivatinst — 83 mmot_eultoole forthe tot. oe Me
3 Now Hea nUAaee ae we a Le: -4 wec
dba! de baile ae tal earars
Qpoe or ratiue uw nneghul ern ov b pus the
yequest tn ta _another —stvuer.
a). OU dont need t Unto cpecial sofware em the
Client oy dexuer.
a A Sepa ses TDRC connect uly »
4) loading 0 tent dxiuens-
Coss: ‘potome " daiuer name”);
(sty dbriey Wasa noe or
2). Creat tonne thon Obj jak. quvemnection Stigy pout
ao con > DetuHanage, getConneetion (at Urd) 5
Chratocol: subprotoort: database |
a Crating dlatemerd. object.
Gatembht st > Con. Geote sjotement 0), peg “tatement
Collale Gotement
Resth 4b
y). P
Paultet i Oe clboale ues (ie Sent + from doblenane").
5) lay ee cannection a
close O 5 1
». feleek™ w qo" 4 L‘
ity a eatute Gut ay oe —L diver ny
ie Evetute () i sors) Lona ection
" aw Poy = Seutertact
: Reault tek
'
1
,A.aminotes
3 . .
— I Prepotd_uatem ent 1 fenamereriged tiodernent +9
4
To tre ite a uotement objet miay Umer, Ut wut :
Se ved ceils bxeclttog Whe hd celta epaedl Ltatement
Objet undead ;
Feoctuye } O_; tpaxed Clatement object vz that,
— iil — ee «sol ubeent When ite created . The !
2—to_thit_alt_that sin most cover, tHir_so1 elatent ent ‘
dent bp the dBH¢ vipht aw, j-then ati wm piled.
—— fx _a_reautt, the _ Prenewed ent_objtet tontain
: olen lage “a eh, but (0 SAL ctoterrent =
= poselayie In_/DBHS)_14_
that. an ae ty Datars thet__uehen
tit tre olen ent _ executed, the DBHS Can
Nea te Prepaned Statement gol statement _
ui thout — —hawing te t temple Jit wes ~ eo
aan alae eS tMpeee$
———————_ |< sates eo Ushene. FNAME = 0"; :
— prpenttinhas lt (updatesiing ); =
Bigg it
—-— tows Stoveo! Prowdure 4 Sy
oe A Ooved en To -fraup-6 Gav gtakement thet
ee ope forma. pesticulas cee.
Cund “hdy oe utd oft. Oat. —
cpexations— osc gevied -fy_egeeute_onodatabate serucy
———2fos_txaun} pier pecation—or.a.ntnnploydatcbeusA.arminotes
‘hive, fie promate lookup) told be toded ou uoved
pred executed appli cokxon code. tored
——proceclures _tOn be Lom piled and excerted ui th
different parameter, and. raul » on ine howe
tembinodion 6} vinput , cutpuct d output
a
: Exr> -b print Oveuuk set Hat _tontaiw tne named a
Wo Hee ont and tne tolfees — th to e
leffee Beak: tt
Stow SUPPLIERS «
fume , Inc. ; lolombrany—
Aone, inc: \ Colombian
mvior Coffee: French — Roaut— 0
Bll ite Frunch- Rott ma
The +igh Ground »_Espruio-
O1)._cUf} blo Prepared & (olable stcctementt
2). Execute q 4 execute upolate .
0:3). Prepared Wen 4 prepasred call.
0-4) Type 34 Type 4 cdier
@:5)- Sc yeulable 4 upolaxable yault set
0-6) Write dhort note on te towing
D duiur Manayes ,_lomviechan a re Croutuent Iwbeaface
wemlt Suk.
ay: Depa pr TDBC bens iesAaminotes
{spp dat :
ia no J aan Oo
Qhe
os
sar one]
a = Mate uot a ty pel alu feces es
“sun \lethe - nde Tbe] Oalbe Drivaey ”)>
A) Lonnechion ton pri eX jf bonne can Wb Co: Odbe.t
: a 2M) saat
—[Remttort 2 gk: eecute Quer Usetectety om duclent' Jj
aoe ty an 4tlect tA Cn eousle.
wohl Cen next ( a
oracle. jdbc. ann avacle p xt ew
7 Oracle then @ Sttosr >: d postr :
- mes 51D >
ow _ Daksbeue rene,
SAL. “pduer__ huey
eH ee peal on foes >| <98>
“brug Name Za& A.arminotes
prrame vantanl)} (aarart
Create Table Shictent | patna viva (32))5
int iz Cut extawe update (—— )
exteulr( )
ace bled User
oe Clay: ach cu an. Inte :
i drfuers
e Ddrfuec MH h
track
and ~ deur. 9 a Uonnection
trod ane auatiable 4 handltes estanu mor
blw a database % on appropriate dover.
Drluer Honayr Can masrtain 0 Wat duel Classes
frat haue J venistredt thenuetuer b Colby the
4 biuw U.
‘method Ghee! Manoyer vegilter
public. atatic neqiter Dri ver O
» " « ddyepistir Daiuer 0
) " " tonnection qo are Bs Cam url)
[° " " 1" Covimeat ( shin, on, Use y
Comment 3g Pass worek)
ti we te eltabUsh the lonnectton uth the specified
VAL
+t _Lonnection dntevface :
A tonnectir lu the auslon b/w Lua appUcatav and
jhe databore. The lormestion ilertane u’
thatement 1 Prepared Uatement and autatoul wnvle dhe
lownection ton be wick & gu the.
that Ww Objcer 6
oj g dettamnent + databose retadata. The tonnechena
nn One. proulde. mi suedhad tromattion WANA eHOLe
rela fae nas Le wes
i Sto fement. “treatedolomentl)
ee — Uatoment+ Create Catoment (tnt vecutteet type Wu
Shee oe Reuter eg -
j ce tov L) 5 a pune
aie ers
panel neeeaa(? +.
Leta app Coss s+ AU the wrap per clauses Cint, dong bytes
re at, ouble thort) ce vil ro —_ teas Sosfaet
a ~The. output te a rapper nus contoiru
tue
|___or 0 vapectiue (onueati
ie pinta a gat type it a ond oot" i fnton He
| of ie :
te i pie op ay, olin VENOM on) _objent!_
gil os “i :
~a eee 5. ot a
————flalement Cons henbdtetement (.)
PR ceo Statement. a 2_ton — = os.a0 Aaminotes —
+ Realtor rs ‘oe
Remibdt 10 = St exerts uewy (___
Ushile a mextc) t ;
i= aay ett fos fia dat ent
2
My ae en calla Ui__tonalpble or _updatrable+
ext)
cas)
Aout O
b re-fnk LD
out ()
Cint vow)
Ley
Sr to ous
TY PE FORWARD _ ONLY _
does mot chow ony
TYPE_ SCROLL INSENSITIVE >” upaatation
TWPe — $CRoLL _SENSITI
NE
LoNtuR — READ_ ONLY
CONCUR _ UPDATABLE
Statement gt= lon. creat Statement ( Reber. TYPE SROLL —
INTENSITIVE, Retuultaet. ConcuR -READ_ONLY
+ Proayram. des Prepadyed dkatem ent >
Cass abe
L
Pg yim ( thing C3.)
iA.arminotes
n Class joe Name ( i th
be rer ton» Driven_Hanayer = = = :
eed a Uatement pS = Con-peepore tatercent, (Airgent ito
vases (2,9) J 5
ie E ps: “cat Tne Ly tot);
| pa Be Set Bintng C2, Ait) elu
=o ~ ain is ps= xeoute, Ujelate( Jy > 5 bostthos ty pels
—S:0:p lit" ttecord. inserted); tude tale vohy
bi cag tts = e ue L= ps.-—
Reiwte ve = pas-bxcoute Query Oe ld ae
wehurned
Revalt, ut 4 tne se prscsiation a_datobae table restive
; 0. Prakment eb} result tok _b}: Maintained _o.
_ duvapy. polly te wurent Fow. 4_data.._When tne _tureor
ee dt pirat vuudned it tu _poritioved byore tne Jue aor.
anesthe pirat taut the rault ott we meed 2 col —
_———“eern cS ze Cyne veut su_ineyorn.. aan _____Aaminotes
JAEE Oxth -
Application seruer/ Web Sermr
‘Sotelew anna bea
ad Ta ce technologies Stecaful sign 3
) & nt techno lope wed te fold thr rout simp.
the lication |e. business logic Seuisn bec
a ey dt Then b) EB BP ponent Entity ben
Neways 3 on
2) Strutor techno prywiol the appUcation ial
with Ci Le ® eaten 6 i
— dec, —JINDI, oe mail, - 6, ~oMS; tO asa Gransaet
3). Com nuwi cation en : Tw te nnolory cue nag
banp aw t eS pawild The mechan
fe am anaicabi [a put q te app” wheres
they are Laval on joa at
t protocol < Zieh P ast sate peek Wi
Sse
”A.arminotes
tr Clanton Haraped Pesca)
me
ee Bs —___—___—
A ee ee ee
Lb 9 tats an ——E
= > or Hypertext tr _prtowk wa _eneric a=
tne Log tet_ Fadl hte beyond!
type _tart capa biurti -—_ Ub _worel_on_vequert “retporwe.
—-—_basit..._N_ent stnds_oa__ve9. to tne or uen—un—jorm
———%e5--metnod y-URT.(.niforn Resource Sdendipier) + profocer _
: —VersEon falls wed a HIME spp tke mevage _confaini
Neg mdb pier s_olient_.in tor fation_and__potible body
—_Lorent 24104 a connection with the _«exuer, “The ~
Sex wex_in tien _Yespands —wi'th_o. toby Line -follswed_
= HIME Ute message _tontain | slvr info: :
ent Ey meta. Info. +_poaiible boolyterctent. a
TP u_a two. eperals rotocols IP rit fe _prptncak___
———That— takes State Garang ole that data us pecalice ly
tiene ype fla Odd 4a Website tnt s
What e_ Lnat__ovl request 2 je Julpillt er These.
sresuesti_make it to tu _favper_dostinatier jor
———balry sent back and forth_b}uo_a_Chenk ard“ a_web___
i oe _bokyr_tbe “several piece or -paoketi » Tur
= potect nmol oll fae Pa take. He. ‘ome rouse Wher
lag Di dent bbfw—tho_chiend £ JLe_utth arver_. Teh(ES
A.arminotes —
ce protect. thal heap track ieee sae
oe. eae tn same ae Be ney Wwele ges *y,
We error Free. Top 4 IP und tryethes to moue ‘data
Owund on the intemet,
* | _ ae
a. aa DEE Application .
0. Apputation Compon ent Duwelop ment.
4) ee asi-tian I oats inks module -
a. fevnbesdina isl into Application
— $$ «
1) Tawa.
~Serulet | tsP
- ETB
2») Hodule ——> 1B mode (7A)
L, “web medule (WAR) Web arcniene fit
(5 Jawa module (+ gar)
vise. QvChieneA.arminotes
__ ae i Livsager thn, pa
¥ _ 7 Ss
eb Teas ee eee oe
SS No needty mafeh uf
aa Ut wi Uy -——Aaminoies
RUZ ( Remete Hethad snuoeatim)
RMI ds an APL tat prowide a mechanism to wae
Uetvi buted app" in Jawa, The HI allpw an ee
unuoke Mmethedi on an opjech suming in an a
| Te RY allow Obj b Oh} tora muni cation blue VM.
Tauatmi + v Package Umported.
TRHP — Taua feynote Method Protocol .
Sp pp? i in pure Tanor-
CORBA = Won Toua ap plicatiisn
TAV RHI a ¥ exteute Kemote
wth a. A ai ta lo tal fun: colle but
difference. ut that ct bust i elie hesAaminoles
Stub 24 — Skelahwo te ——
tomlin — panei Diy
= ae
a ye on ie ——— date
—— Shab ian 0kf- _ach_04-0.. fatew the Ulett aide. 4U the
a egy 4 auiee ane. a, inde it. tt veulde at the
all ide Wwhen he cotlesr 4n the _metnod mm
att obj da doet he polowing tose?
= _dalnidtate a wnnect'n with yomote uirtual machine.
ube Sk_writes and tranmits (>nwuhBh 1 the porametene te
__semote_uittuol_amacnine.
AY t¢ walk =i the vault -
Nw dt neads Unmanahells) the relusn value ox exception...’
vi Mie aduery the value. to the caller.
+ Skeleton ize tes oct fo
ae Skeleton act off a__fotero nl des Au
_uinComi quest. ak out =
__(sh ea tf ae receiver >the. ini Meg eLelt, ve
-.dovs_the —5 bak.» =
ptt reac “ne Rese: Pe tne remote method
i) 4 dnuoke tne method en the actual "emote object -
Mi) vero, fron mith tne toule ty tne Caller. (Matai
od Gee
a reaTh teporti ble pe mange. tne pene snade bs
the client doe Dean -ob}-on Struey. $0,
aol oble_on betty —Rarinotes
The Client aide RRL veceiuer the “p. metnads from
“ine chub dhat ui transfersed vinto diam
proce called wxialyation ov Hauh and_-+tnen
there olata aw tend te fhe #exuey 8 en.
¢#
94 toga (harvard layer)
+
4 Hops joc KUL application :»
4). feats a remote uvtterface.
9). Prouide the implementation Remote Interface -
3).__Geote thub 4+ skeleton obj. thing ymic command.
Wj frank tne replete venice by ami why Foot:
a). Qeate $ Haut thY vemole application ov struer.
6) Geate 2 Liat the Client Appui cation .
4 _frprom - ( RHI apptication) :
Roduct, java. ys & >
Peble Interface Proctuct extenos Remote
Toure
Puolic — get Nome ld: product fave
Product Imp le- va
Umport jOud- Yeni: &
dmport Java ° rmi+ sexvers * 5 Jat
greple SousA.arminotes
pie Praduck Imple- ertends unicaBemats Objet -
—___ ett Bhat. 5, eee Arp duet
— Shing manors ss =~
iia SImple- “te mame) 4 a
_ Roduck * teluess jou. .
———limpor joan Lenn. er B Ta 4 3) Co tt res
a Su — eet a
pa mnain. (ring ac) = ea
——Pratack | ope Be meio > rock = Ss
Maing rebind |" “Cold dank pie se ta
Naming vebind _C" Seo trsom.” :A.arminotes
(olen ( Breeption ¢.) —
5
3
noduck Cient- java.
Lie claws product Hida ot
a main ( ny atl any
Yh,
oduct p P= (product) Nami ~ Lookup (ymit/t
f Paseo: tooo) told dink" ) :
ate So-P(" Product nome &! + Ps gekNameC)5
Catch | exception ©)
e
J
Y
any ie mmethodu P a 2 oblaininy
remote Srjects, 7 a remote bbjeetA.aminotes ;
iN aa etal aM omg 2 EY.
Pee Lateiny 5
ota ta a
2 _unbtind oe an
"_ vebind my objet)
and. “Unbind. a
oe a
Es wile pe thot ale. mm dial Plows — eeneey
D2 Unitate. .
BResob ob tai
i Remote yore iii) Nasal (low iy) RH) or
——i_Lodlap sm dy) Hang - pation halling
— PF _ (seulali patton a)
2) _fweniyechne ae — _
all % wee
Lop Lape) iu 4A.aminotes
ae Sorulet
1 ao
pra: Serulet o e ai
? Ad ts
a lik.
>No procen treahon ouerhead.
a ficfene
a Robust
7 Seure
> Peuitent
Senulet Life tyole :»
) dru ankadion» ‘
7 ucater an lnutance
help 4 nw Regusor .
F 7 ident (Genelet Cory? Con
) Snctinbigahion :» A posto. vale nit € ag ong)
Init method fds Cauled
> Qui +3 (serulethevent vey , Struled Racporse, vee)
the web strwer has a veuelt yA stylet uit cath the.
gervulet dnitances serwea’() method. ~ |
athe terulef Clans wet ine
) Destroy:
soe alert the uutane , the Container tale derulet
Unjtance’t rey c) method.
D Unawailoble '» :
Ths unstana Js olsstroyed £ marked for sueape
Collection .A.arminotes
(
Lo seawer £04) ‘
gender Lipegy ele ‘
ait
sed £ = oh me tN
= Strulet_Relporue > Output pint :
ect - ( . ue oo
L turead
> aa |
le aed S evules—Ufe_tyrole vie ys)
eto | a
onda) huttdoumlong
A.arminotes
> Servlet Requesk.
) gutpretocol
> gttRemote Addy. ()
? Remote Hoik C3
) Sequer Name
‘get Setuer port ©
Void. +) “set Attribute ( Sting name obj: )
*) get Ath bute (sting me
Hetinod to Request Porometert 72
— oi Parameters ( string mame)
— ding CT get Parameter Vales { ding a)
— &u revo qt favasmetes Names (JS
(erecta pode eu
(peer protected Sexuien (
Hibtp Serlok J
do x xx
do but
do pott
Umposk jouax: Ser let. X 3
pra r Senet hip X 5
puslic class abe 4 ertendcu tutp Sex wlet
L:
es —
ubuic void int © & i "
P fe void int ywlet fontia Conhig)
y clotet
Uc vafd gevuice ( Serutet R t veg , Cenulet Rupore ves)
pub : ul Cpuest 109, Cex Reap
va. Stkontent Type ("tex t/ Html"
Pri nt atten ae a.
ps print ( "2 thm >& body >”);
pio: priniln { “HEuo" J;
aie pointin ("<1 body> témi>);
F login jutmb
____< tHtim>
< body >< form method =" Post” attion * 2
Uerndine < Jnput type 2," text" mame =" Uname'/>
fas word
fowm>