Dab tsi yog kev siv chav kawm rauName hauv JDBC?
Dab tsi yog kev siv chav kawm rauName hauv JDBC?

Video: Dab tsi yog kev siv chav kawm rauName hauv JDBC?

Video: Dab tsi yog kev siv chav kawm rauName hauv JDBC?
Video: Leng Yang - Yog Vim Dab Tsi (Official Full Song | Nkauj Tawm Tshiab) 2020/05/24 2024, Kaum ib hlis
Anonim

Chav kawm thiab cov rau npe () yog txoj kev zoo li qub ntawm java. lang. Chav kawm . Cov JDBC Tsav tsheb (Txoj hlua) yuav thauj khoom rau hauv chav kawm dynamically ntawm lub sijhawm khiav thiab rau npe txoj kev muaj static block uas tsim tus tsav tsheb chav kawm khoom thiab sau npe nrog DriverManager Service tau txais.

Cov lus nug tseem yog, chav kawm rau npe ua dab tsi hauv JDBC?

rau npe () Txoj hauv kev zoo tshaj plaws los sau npe tus neeg tsav tsheb yog siv Java's Chav kawm . rau npe () txoj kev, dynamically load tus tsav tsheb chav kawm cov ntaub ntawv rau hauv lub cim xeeb, uas cia li sau npe rau nws.

Tsis tas li ntawd, chav kawm forName ua haujlwm li cas hauv Java? rau npe yog siv los thauj cov chav kawm dynamically qhov twg peb tsis paub lub chav kawm npe ua ntej tes. Ib zaug lub chav kawm yog loaded peb yuav siv newInstance() txoj kev los tsim cov khoom dynamically. Cia peb xav tias peb muaj ib chav kawm "Test", thiab peb ua ib tug hu zoo li Chav kawm . rau npe (“com.

Yog li ntawd, kev siv chav kawm rauName com mysql JDBC tsav tsheb yog dab tsi?

Chav kawm yog a chav kawm uas tag nrho cov tus tsav tsheb yuav tsum tau sau npe uas yuav yog siv los ntawm peb thiab hauv qhov ntawd chav kawm muaj ib txoj kev zoo li qub hu ua rau npe () uas thauj thiab sau npe rau peb tus tsav tsheb (zoo li mysql driver class ) dynamically. yog li ntawd, peb sau raws li nyob rau hauv thawj kab, Chav kawm . rau npe ( com.

DriverManager hauv JDBC yog dab tsi?

Cov DriverManager chav kawm yog cov txheej txheem kev tswj hwm ib txwm muaj JDBC , ua haujlwm ntawm tus neeg siv thiab cov tsav tsheb. Nws ua raws cov tsav tsheb uas muaj thiab ua haujlwm tsim kom muaj kev sib txuas ntawm cov ntaub ntawv thiab cov tsav tsheb tsim nyog.

Pom zoo: