IT/자바, 스프링
스프링 db연결 설정 (application.properties 파일)
thesse
2021. 8. 9. 14:23
300x250
반응형
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver // 마리아db 드라이버
spring.datasource.url=jdbc:mariadb://localhost:3306/testdb // db주소
spring.datasource.username=root // 유저네임
spring.datasource.password=pw // 패스워드
spring.jpa.hibernate.ddl-auto=update // ddl 설정*
spring.jpa.show-sql=true // 로그에 sql 보여주기
spring.jpa.properties.hibernate.format_sql=true // sql 보여줄 때 포맷 예쁘게
spring.jpa.hibernate.ddl-auto 옵션
- none
- create : 시작할 때마다 다시 생성
- create-drop : 시작할때 생성 후 종료할때 드롭
- update : 시작할때 entity 클래스와 db 비교해서 없는 테이블/컬럼 db에 생성 (제거는 안함)
- validate : 시작할때 `` 비교해서 다르면 예외 발생
300x250
반응형