스프링부트에서 MySQL과 PostgreSQL 를 사용하기 위해 다음과 같은 설정들이 필요하다.
MySQL
1) 의존성추가
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
2) Datasource 설정
spring.datasource.url=jdbc:mysql://localhost:3306/springboot
spring.datasource.username=username
spring.datasource.password=password
PostgreSQL
1) 의존성 추가
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
2) Datasource 설정
spring.datasource.url=jdbc:postgresql://localhost:5432/springboot
spring.datasource.username=username
spring.datasource.password=password
'Study > Spring boot' 카테고리의 다른 글
[Spring Boot] 스프링 데이터 - 데이터베이스 초기화 (0) | 2021.01.03 |
---|---|
[Spring Boot] 스프링 데이터 JPA (0) | 2021.01.02 |
[Spring Boot] 스프링 데이터 - H2 인메모리 데이터베이스 (0) | 2020.12.26 |
[Spring Boot] 스프링 웹 MVC - CORS (0) | 2020.12.26 |
[Spring Boot] 스프링 웹 MVC - HATEOAS (0) | 2020.12.26 |