Dab tsi yog qhov txawv ntawm PreparedStatement thiab CallableStatement?
Dab tsi yog qhov txawv ntawm PreparedStatement thiab CallableStatement?

Video: Dab tsi yog qhov txawv ntawm PreparedStatement thiab CallableStatement?

Video: Dab tsi yog qhov txawv ntawm PreparedStatement thiab CallableStatement?
Video: Qhov Sib Txawv Ntawm Allergy, Flu & Coronavirus Yog Dab Tsi 2024, Hlis ntuj nqeg
Anonim

CallableStatement yog siv los ua cov txheej txheem khaws cia. CallableStatement txuas ntxiv Npaj Cov Lus Qhia . Lawv yog: IN - siv los dhau qhov tseem ceeb rau cov txheej txheem khaws cia, OUT - siv los tuav cov txiaj ntsig rov qab los ntawm cov txheej txheem khaws cia thiab IN OUT - ua raws li ob qho tib si IN thiab OUT parameter.

Ntxiv rau qhov no, Daim Ntawv Ceeb Toom Npaj thiab CallableStatement yog dab tsi?

Cov Nqe lus yog siv los ua SQL zoo li qub nqe lus . Cov Npaj Cov Lus Qhia yog siv los ua SQL precompiled nqe lus . Cov CallableStatement yog ib qho interface uas yog siv los ua SQL khaws cov txheej txheem, cursors, thiab Functions. Yog li Npaj Cov Lus Qhia yog sai dua Nqe lus.

Ib sab saum toj no, kev siv CallableStatement yog dab tsi? CallableStatement yog siv hu rau cov txheej txheem khaws cia hauv database. Cov txheej txheem khaws cia zoo li kev ua haujlwm lossis txoj hauv kev hauv chav kawm, tshwj tsis yog nws nyob hauv cov ntaub ntawv. Qee qhov kev ua haujlwm hnyav ntawm cov ntaub ntawv yuav tau txais txiaj ntsig zoo los ntawm kev ua haujlwm hauv tib lub cim xeeb chaw raws li cov ntaub ntawv server, raws li cov txheej txheem khaws cia.

Tib neeg kuj nug, nqe lus twg zoo dua los yog Npaj Cov Lus Qhia?

Feem ntau, Npaj Cov Lus Qhia muab zoo dua kev ua tau zoo dua Nqe lus object vim pre-compilation ntawm SQL query ntawm lub database server. Thaum koj siv Npaj Cov Lus Qhia , cov lus nug tau muab tso ua ke thawj zaug tab sis tom qab ntawd nws yog cached ntawm tus neeg rau zaub mov database, ua rau kev khiav nrawm dua.

Txoj kev twg yog siv los tsim cov khoom CallableStatement?

CallableStatement khoom yog tsim nrog kev sib txuas txoj kev npajCall. Cov piv txwv hauv qab no, nyob rau hauv uas con yog ib qho active JDBC Connection khoom , tsim ib eg CallableStatement.

Pom zoo: