Cov txheej txheem:

Kuv yuav ua li cas thiaj tsim tau qhov kev sib txuas database hauv lub caij nplooj ntoos hlav?
Kuv yuav ua li cas thiaj tsim tau qhov kev sib txuas database hauv lub caij nplooj ntoos hlav?

Video: Kuv yuav ua li cas thiaj tsim tau qhov kev sib txuas database hauv lub caij nplooj ntoos hlav?

Video: Kuv yuav ua li cas thiaj tsim tau qhov kev sib txuas database hauv lub caij nplooj ntoos hlav?
Video: Tsis Deev Koj Thiaj Tsis Seev BY Aka 2024, Kaum ib hlis
Anonim

Txhawm rau nkag mus rau Relational Database los ntawm kev siv JdbcTemplate hauv Caij nplooj ntoos hlav Boot daim ntawv thov, peb yuav tsum tau ntxiv cov Caij nplooj ntoos hlav Boot Starter JDBC nyob ntawm peb tsim configuration file. Tom qab ntawd, yog tias koj @Autowired chav kawm JdbcTemplate, Caij nplooj ntoos hlav Boot yeej txuas cov Database thiab teev cov Datasource rau cov khoom JdbcTemplate.

Nyob rau hauv txoj kev no, lub caij nplooj ntoos hlav khau raj txuas rau sab nraud database li cas?

Hloov kho lub Caij Nplooj Ntoos Hlav Project Ib kauj ruam los ntawm kauj ruam

  1. Kauj ruam 1 - Ntxiv ib qho kev vam khom rau koj cov ntaub ntawv txuas rau pom. xml.
  2. Kauj Ruam 2 - Tshem tawm H2 Dependency Los ntawm pom.xml. Los yog tsawg kawg ua nws qhov kev xeem raws li kev sim.
  3. Kauj ruam 3 - Teeb Koj MySQL Database.
  4. Kauj ruam 4 - Configure koj kev twb kev txuas rau koj Database.
  5. Kauj ruam 5 - Rov pib dua thiab koj npaj txhij!

Ib yam li ntawd, koj tsim cov ntaub ntawv li cas? Txhawm rau tsim cov ntaub ntawv tshiab:

  1. Hauv Start tab, nyem Teeb Cov Ntaub Ntawv Source.
  2. Hauv lub npe teb, ntaus lub npe ntawm cov ntaub ntawv tshiab.
  3. Qhia meej hom ntawm cov ntaub ntawv qhov chaw.
  4. Hloov kho qhov txuas URL.
  5. Ntaus tus username thiab password uas muab kev nkag mus rau cov ntaub ntawv qhov chaw.

Khaws qhov no hauv kev xav, dab tsi yog lub caij nplooj ntoos hlav datasource?

A datasource yog lub Hoobkas rau kev sib txuas rau txhua lub cev cov ntaub ntawv qhov chaw . Lwm txoj hauv kev rau DriverManager chaw. Nws siv qhov URL nrog rau qee cov ntawv pov thawj los tsim kom muaj kev sib txuas ntawm cov ntaub ntawv. Ib yam khoom uas siv javax. sql ua.

JPA yog dab tsi thaum caij nplooj ntoos hlav?

JPA (Java Persistent API) yog lub hnub tshwj xeeb rau cov khoom txuas ntxiv hauv daim ntawv thov kev lag luam. Tam sim no nws yog siv los hloov cov noob taum complex.

Pom zoo: