Fix: Failed to configure a DataSource: url attribute is not specified [Spring Data JPA]

***************************
APPLICATION FAILED TO START
***************************

Description:

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


Action:

Consider the following:
	If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
	If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).


Process finished with exit code 1

If you are making use of the spring-boot-starter-data-jpa in your application and when you start your application, you get the above error, one common reason for this is that you have missed adding the datasouce url path in either of application.properties or application.yml file.

Make sure you have the below property added.

spring.datasource.url

Example:
spring.datasource.url=jdbc:mysql://localhost:3306/db2

If using application.yml,

spring:
  datasource:
      url: jdbc:oracle:thin:@localhost:1521:db1
spring.datasource

Comments & Discussion

Facing issues? Have questions? Post them here! We're happy to help!