JDBC 1
JDBC 1
DDBC
Unt
AP2
Ttodwkon:
Evey J2EE appl'akan Saves rebuevens wamipulateo
a
iohmahan sloed in dataase wsing web servies
povded by a gzcE Conmponent
objec
to a
Jaua datt objeth haue methods that pena cnneekon
wanapeme yatem (osms) s dhen tnamit
database ldeet oala
inset veene,
modyy
memapes (queies)
a dotokase.
Šhoed in do dend
Connecha
- Iheoßms wse the Aae These mmmapes conin
bock to he oEE Conpmet. Comfonent/igomatim
by I JaEt
data vegueteol
- JBMs o Sybase,nt
covnmercialy avasabl ! OYach,B62,
challege Sum an l9 905 : Sevelop a lay f jaa
popua
wwte high code that acenses all
ded
dauops to
Leslet ado DßMs's.
D6Ms
obshade: Lanupe balieA. Eoh
Les cala soed
uiten Cowuniak
o
code
in iti data hanes. je. banelaoleuel
miplt eed fo be to
veuuitten
uth ta oYacle data
aLLe a D82 dataase.
02
e gs8¢
met The challeyge wits the eahon
-To l336
by Sum Mitvosyolemy
ne.
The gRsc dhinen deuekpel
-th a Apeckeaton trat
isUl. nchonalty itaas
dierdeail JAsc duier
desev bed h da
tms wamuphes thidl paty verds aene Aum
at Coryneo to
en couraped to bud Jßc diveyThose
speciaos. wstat bud
Mrosyotems, nts,
neA.
JOsL duVeA.
03
daiver to the MS
itout Validahon. e. ei i Ia
Yerpomly ka
8ms do twplenent cal Aatement
Cantained in te qe
- goup' vehMR to
fh
ane a Jallouo:
>open Baaane Canmecho
API.
-The gsLe do o8ße dive alho caled tha cBclOBc Bade
0 used do tamlate ßMSs
cals ba the JocApeetiahon
speute
coyoms do Apeyicahon
Jerff Coponet that
-Those vnemaes
e
taated
The oße
by the Jese to 08ßc dhve
th 6MS.
B6M:
fammat vauved
Vegihed by
by dhe
eesies e hamlatesd nto the fomat Yegie
oAMS.
SAL quules do vot ned t be comvened to Jese
femated Systems.
-Adv: > rtert wa to Commnicte SQL ees to
JeBe Paages:
>
These înehde aa data caje cti tiat povde the
JouaLnaL
(6)
daa \menage
Jauaoajey
ojecki ttrat inteat cith th Javo Nawug Biredoy
podg Tosa dat oeus that wanape
(JNOI)
nlepee
ose
Con necha poog, monpoher advamced
eahues
Type 1: JDBC-ODBC Bridge Driver
Local Computer
Java Ápplication DB
|
Vendor
Application Code Driver
Type1 ODBC
JDBC ODBC Bridge Driver Local
DBMS
Database Server
Application Code
Local
DBMS
Typo 2- Nativo API
Database Server
JDBC-Net pure Java
Type 3:
Middieware Sever
Local Computor
Application Code
JDBC Typo 2 Drivor
Notwork
Proprictary Vondor Communication
Specific Protocol
Database Server
Java Application
Application Codc
Type 4
100% Pure Java Loca!
DBMS
Database Server
06
A
Brtel Ovelvieu ha feßc ocesi
a
Jhis proces : dividdnto 5
Yhineni
diver
3 Conechng to tha otMs.
Creatne g a
execuhp stadenent
Processg data yehunol by hu MMs,
Teinabine the onnehon ut tta ons.
- the
&de dien must be toodeo heyole
tu f2€E omyoet
Conne do th %MS.
Con
Namec) method is wned to load theJDBe divea.
The
cla. to wo/k Ghline
, ute a
k9. Suppobe duloper
a tuants
T2EG Coonent that interats its MirostAces
Fo Oracded
Clan. fa Name/ovade. jdbc. dinea. 0aceafinen
The wManapen gelonnechan) wethnsd is pnsed the UAL
PMS.
Wame
Copoment
the aabane tat w
beingacne by te qéE
th SrveMamgagekonnechomc) method retng aa Conmeckiog
inteyae dhat s sed thoghout The pro cens do yYeleenie he
data lease. Copial Lettes
-The jaua.soy onechom ideyae is amothe membe tha
mamapes CommmicahRon behuean the ole
jaua sq poukage
tat
is the jauasl- Gonnectin nteyoe dhat end sateeut to
-ît
The wwe
The aivemanapengekonnechant method to Aoad
conmet to The custmemahon
the goscl 0a8c bafe
databane. Ariven Namne
>Capital Lete
rtvade comechon ob
> Captalletes
nechion :
Aayl. Con
java.
imypot rienangpen,
java. hayl. BiveMamgej
impt java
. Dql. statamut;
a SeL Sktement,
Nesdt step àn to nend a
sel queny to
Ihe aBMS Ja poeoig
eny a deies AseL Commands dhat
nel oisto
CaYeet tha Bms to do Somelhing Aeh a do
rehn vous
d data to the TLEE Component. a
unedl to create
- The omect. create.satemet )malhod
js tren ed to execake 's
Captell siatenent chjet
objet. Thee Salent repom
Ltte Salememt
rehun
a Reultsetojeet tat Contivste
qe às usually ame[we
Yous
om he
BMI,sich
Yeguesked by the J2cE omponet
ystechis paned
to astrip ohjet
he queny's aspned method.
exeuteQueny )
odajecn
do the Slatement clobec
om the OBM,Ihe
neelhe Reultet is eceived
btalemment
Caded to dermivale the
metod ) rom the Custmen
ie Yous E Colunns
Retrieve al sikatewent objet
talale.
Gapiel
Sateme 2ata Reques
do
madhocs used
The aua. SsLiRenulktet oajech coint
tnterat uith dato that velameo by the Bßsto The
JREE Comonent
Row
[Firat
[Fi
Wnp Fst Nawne, LantName, priras ue -Succes
fabe-Falne.
bodtea Recado Reltoneto; CNo
Rows]
dat vehwned)
Splem. ow
pritln ("No
Yen
tke
else z Name
s Name
do
setjrig (Fist
(Fist.
FistName- Rerls. getsrinp
CatNomme Reuls.
+ +Lastnome
prinkrw FistNane
Nyotem. ou prut (printra);
} cstule (Renlb neytys
fist ame
&
cuotomnas
requeted
Jacc Component by Te SRM
-A
latnome fom
a table.
Tu veru vehned
oajet callid Reauto
oheody mpned to t5e
Reuset Keutsel y
Ast tine dtat
metthod
tieneto R
l ya
ta
-[he ponhonel at
poiter 'n
Renulse daloe
Called Thu ttat
1he Retse
a rehnwa boean vele
in
- A rue value
reumed
deast
- tha Reullset to a
glrip clajet.
mehod Te oVedioy
auceming he AIMS. claes
fished comnehin automatall
- doring he datase Roultot ephity
Altagh better to clore the
a keutset, it Gmnechan.
the
behe cloing
9b.cooec); aa Roquet.clsec
1
objcc
Connecon fhataat.
Reuls. cldec;
Rerult ,t object.
Tronoation
Proeimg:
way
-A tyamacian invoe sevesal taaks.
Pmalogy: Tamsachion ata Super Maket.
O
Each item puhased mut be vegrtened.
mut be taled.
ihe tachon
3)
lhe custome st tender tie onnant the puehase.
Sueemjul Tramsachin:
3 eoch tank 'in conpleed Suceuly.
) Failedd Tranackon:
ne daak ilo.
Achonoe faidd tasko nt be reveYoed.
Cnblee
updatn
sQL daements
-A data base daoaios cisto a bet
succemly omplled.
soL otementmust be
Eah
Faled Taachon: dhat
> sQL sbtement tet exeuted seyully upto
point an The daacbn ut be Yolbok.
Commito:
Comleeo mhl the FeEE Comyanent
A
dotobane tawacton dot
Call he Commit ) method The conneckon oejeet.
prioY do Ihe Call to The Commity
Al saL statemet eneule
method Cam be oledbok.
none he AL statemen
one Committ) metnod is called
.
Can be vdled bok.
Lomitmhod
mu be alled repales y
the Ja ateet
was
a
JRpo: opem a.
Conneon
auto omnet as Jahe deachvakion
slep+: set eatin
awo com it
yi Conn. sekAuoCommit (febe
,vlled bek):
Com. follbik; |Rolzak the tansahan beedayiy
mthe screen.
ercep)!
Lyath (saLExepln
fylem.err. pratn ("excep
guilge:
mwhod ds aled
Nte SetAuto amity
Gorpleted
O3
nee fo be
tieh dont
may covinti wamytts, ome
-A tramsachan
vohelock tntve tasackions gads.
techiely
Nes ode Procering.
customes awnt tabe
updating the doen talble.
(0 Bmseng The dden into peleng
(D mahon email
cuotome a Cotr
(c) Sendi a
Suengul
> Not neceMay rolbak th entire tansahn,
do
Cohme to be
bakgne.
e dde
moe that
imatat Cam dent one tke evaid seveh Is
>It in notice be
Conymaton
- Stautom:
Savepois d bnts thet ae
Compoinent Can Conto tfe nuben
>
JE
led ba.
>oduted in gotc3. o
waske hat daines the tsk atuheh
T}s vitual a
The olback sbps.
heve Can be
mamy Savepinto
wse
in a tamsachan
>
Eah ave pimnt i îdenhe by a unqe
mithod to
Swe poit vame inthen Poe
do the yeloek)
Tke yolbak
bpeutyte point wttin the yanachn hee
às to stop.
to Tha
to be Yomovd is parsed
rat is
Saepont
Veleane Sve foint method.
edcephom las
usor
hio menae
o the ahal
Connecbon O4
Safabase,
Aoo base.stAutoComit
le):
"upoata customels set sheet Main yhee
T
'5
shee stNamme'Bo
heet't
fng uey,"updbt
"upoat Customus set sheet-'1o Maim
Salalaae- clone;
aguage );)
$yptemy. exit (4);
statememti
(h) bath
-To conwbine sdL statements to a trannatn id to badeh togetne
these ptateent ino a
Al tomsechin then eneute te entive
taachn.
Call Cleanlialtht)
, as doy as you cal t befe caliig eecutetahy
sbtemetin
upate the bath
Rehee the update Gunt edh
update tat escutid Sustlly beethis cephto
mecerly, ehums am
al Comads edeed Stalement
Cowns fo Re enpechve updatr)
Waere
> a
Sulbcas sQLErcelion
>
dtemine he
uben Youws
thot eoeh saL dtolemen updated.
Ycus comt be deteinedl
3 onen ocwned duing update.
Creatiotet o6
+
t e. get Menafe
el Eracode
( o):
0):
erd Gots he e
ano
umben eAcephim
ithThe
hecallingstomt
out. print(updaled C): by No
uk,
St)
SQLCXcephin soyl err; bakhoherthan
enetyaasbleol
Kenmove o the
Aota Yemove
sten
allth Jelechey
Requst.cleonBath method
asled. ant
yan
haeneto
cath(eoth tipdatoEceptibn err Chocse Yemove.
ed getmemggec)