Small Asteroid Blog

[spring] application.properties 의 datasource 설정하기(port, db) - DB연결하기 본문

백엔드/Spring

[spring] application.properties 의 datasource 설정하기(port, db) - DB연결하기

작은소행성☄️ 2021. 4. 27. 10:09
728x90

 

 

포트번호 변경

server.port=8082

 

 

 

데이터베이스 연결

# Database
#driver-class-name 은 사용하고자 하는 데이터베이스로
#spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
spring.datasource.driverClassName=org.mariadb.jdbc.Driver
#spring.datasource.url=데이터베이스 주소
spring.datasource.url=jdbc:mariadb://localhost:3306/gtck?characterEncoding=UTF-8&serverTimezone=UTC
spring.datasource.username=아이디
spring.datasource.password=비밀번호
#spring.datasource.sql-script-encoding=UTF-8

 

 

db 업데이트 

spring.jpa.hibernate.ddl-auto=update
# create = 실행될때마다 새로만들어짐
# update = 실행될때마다 다시 업로드됨 oracle에서 건드려도 이해를함
# none = 안건드림



 

 

 

 

 

 

postgresql db 연결

spring.datasource.driverClassName=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://localhost:5432/gtck?characterEncoding=UTF-8&serverTimezone=UTC
spring.datasource.username=아이디
spring.datasource.password=비밀번호

 

 

728x90
반응형