Professional Documents
Culture Documents
23metsyS\%tooRmetsyS% :morF 46WOWsyS\%tooRmetsyS% :ot nI tratS exe.23dacbdo\23metsyS\%tooRmetsyS% :morF exe.23dacbdo\46WOWsyS\%tooRmetsyS% :ot dleif tegraT 'KO' kcilc dna gniwollof eht egnahc ,seitreporp nI
Click Microsoft Access Driver (*.mdb, *.accdb) and click on Finish button. 5. Then...
Insert your own Data Source Name (this is the name you will be using in the Java code to connect to the database, so ideally try to keep the database name and the DSN name to be the same) and click on Select button. 6. Then...
Choose your Database Access file like above and click OK button. *** Note: before these procedures, we must have a Database Access file. We can make this file by using MS Access.
} ;))3(gn irtS teg.tesr + " :SS ERD DA + " : E MA N " + )2(gn irtS teg.tesr
; ) L Q S t c e l e s ( y r e u Q e t u c e x e . t m t s = t e s r t e S tl u s e R ;)(tne m e tat S etaerc. n noc = tmts tnem et a tS ;"sserdd a_bt mo rf S S ERD DA , E M AN ,DI tc eles" = LQS tcel e s gni rtS { y rt
; ) " ! ! ! l u f s s e c c u s s i n oi t c e n n o c " ( n l t ni r p . t u o . m e t s y S } ;)es( n ltn irp. tuo. metsyS { )es n oi tpecxELQS(hctac } ; ) " e s a b a t a d _ y m : c b d o : c b dj " ( n o i t c e n n o C t e g . r e g a n a M r e v i r D = n n o c { y rt B D o t t c e n n o c //
} ;)e( n ltn irp. tuo. metsyS { )e no itpecxE dnu oFtoNssalC(hctac } ;)"revirDcb dOcbdJ.cbdo.c b dj. nus"(e maNrof.ss a lC { y rt r e v i r d c b d j r e t s i g e r //
;* .lqs.ava j tr o pmi
Here is a simple Java code that executes a SELECT statement. 7. Now, we can test our JDBC program with MS Access.
tb_address, by using SQL Plus in Oracle and insert some values. For Oracle thin driver, you can use the following in the Java code:
jdbc:oracle:thin:@//<HOST>:<PORT>/<SID> - url would look like this for SQL Plus, to make connection jdbc:oracle:thin:@<HOST>:<PORT>:<SID> - url would look like this in general, for making connection oracle.jdbc.driver.OracleDriver - for loading driver
To find the host and port, follow the path (in Russ labs): C:\DevSuiteHome\NETWORK\ADMIN And open the tnsnames.ora file in Notepad, then you will find hostname and port. For the Russ labs, HOST is cseora.cs.wright.edu PORT is 1521 SID (Service Name) is cseora11 For example, this is how to make a connection in Java with SQL Plus (in Russ labs):
; ) " r e gi t " , "tt o c s " , "
cseora.cs.wright.edu/cseora11
;))3(gn irtS teg.tesr + " :SS ERD DA + " : E MA N " + )2(gn irtS teg.tesr
; ) L Q S t c e l e s ( y r e u Q e t u c e x e . t m t s = t e s r t e S tl u s e R ;)(tne m e tat S etaerc. n noc = tmts tnem et a tS ;"sserdd a_bt mo rf S S ERD DA , E M AN ,DI tc eles" = LQS tcel e s gni rtS { y rt
cseora.cs.wright.edu/cseora11
{ y rt B D o t t c e n n o c //