Cov txheej txheem:

Dab tsi yog qhov txawv ntawm kev zam hauv JDBC?
Dab tsi yog qhov txawv ntawm kev zam hauv JDBC?

Video: Dab tsi yog qhov txawv ntawm kev zam hauv JDBC?

Video: Dab tsi yog qhov txawv ntawm kev zam hauv JDBC?
Video: nkauj tawm tshiab 2023 Npawm lem and tub zeb vwj 2024, Hlis ntuj nqeg
Anonim

JDBC Exception

  • Nkag siab nrog Piv txwv.
  • Tus tsav tsheb. getConnection (): Qhov no yog siv los tsim kev sib txuas ntawm url thiab database.
  • con. tsim nqe lus (): Qhov no yog siv los tsim cov khoom Sql.
  • executeQuery (): Qhov no yog siv los xa cov txiaj ntsig tau los ntawm cov ntaub ntawv teev tseg ntawm cov ntaub ntawv.
  • rs.
  • Tso zis.

Hais txog qhov no, dab tsi yog qhov txawv ntawm kev zam hauv Java?

Hom Exception hauv Java nrog piv txwv

  • ArithmeticException. Nws raug pov tseg thaum muaj xwm txheej tshwj xeeb tau tshwm sim hauv kev ua lej lej.
  • ArrayIndexOutOfBoundsException.
  • ClassNotFoundException.
  • FileNotFoundException.
  • IOException.
  • InterruptedException.
  • NoSuchFieldException.
  • NoSuchMethodException.

Ib yam li ntawd, JDBC cov kev zam yog dab tsi?

  • Java.sql. BatchUpdateException.
  • java.sql. SQLException.
  • java.sql. DataTruncation.
  • java.sql. SQLWarning.

Kuj kom paub, hom kev zam yog dab tsi?

Feem ntau muaj ob hom kev zam : checked thiab unchecked qhov twg yuam kev yog suav hais tias yog unchecked kev zam . Lub hnub microsystem hais tias muaj peb hom kev zam : Tshawb xyuas Kev zam . Unchecked Kev zam.

Hom Exception tuav:

  • Chav kawm tsis pom muaj kev zam.
  • IOException.
  • Runtime kev zam.

Dab tsi yog kev zam thiab ntau hom kev zam?

Koj tseem yuav kawm txog ntau hom kev zam hauv Java . Kev zam yog qhov tsis xav tau lossis cov kab mob lossis cov xwm txheej uas txwv qhov kev ua haujlwm ib txwm ua. Txhua lub sij hawm muaj kev zam tshwm sim, qhov kev ua haujlwm raug cuam tshuam. Cov lus yuam kev tshwm nyob rau ntawm qhov screen.

Pom zoo: