Study/SpringBoot

[SpringBoot/MariaDB] Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. 에러 해결법

growingtree 2022. 1. 21. 16:18

작업 환경

Windows 10

Intellij IDEA 2021.12

Java 8 

MariaDB 10.6 

sdk 1.8.0 

maven

 

 

 

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class

 

위와 같은 에러가 뜬다면 application.properties 에서 아래의 내용을 추가해주면 된다. 

spring.datasource.driverClassName=com.mariadb.jdbc.Driver
spring.datasource.url=jdbc:mariadb://[주소]:[포트번호(default:3306)]/[DB명]
spring.datasource.username=[사용자이름]
spring.datasource.password=[사용자비밀번호]

나의 경우 

spring.datasource.driverClassName=com.mariadb.jdbc.Driver
spring.datasource.url=jdbc:mariadb://localhost:3306/test
spring.datasource.username=root
spring.datasource.password=*****

추가하고 main 함수 실행하면 정상 작동한다 

반응형