스프링부트에서 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

 

+ Recent posts