0

this is a first time i am doing a simple spring boot crud i ran in to the problem with

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

i don't how to solve the problem I added in drivers correct way but I got the error pls solve this problem

application.properties

spring.datasource.url=jdbc:mysql://localhost:3306/mlab
spring.datasource.username=root
spring.datasource.password=

porm.xml

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <scope>runtime</scope>
</dependency>

2 Answers 2

1

It seems that you failed to provide driver-class name.

spring.datasource.url=jdbc:mysql://localhost:3306/mlab
spring.datasource.username=root
spring.datasource.password=
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

You can refer to : https://www.baeldung.com/spring-boot-failed-to-configure-data-source

It should be work after adding the above mentioned properties.

Sign up to request clarification or add additional context in comments.

7 Comments

can you please check if you have added <artifactId>spring-boot-starter-data-jpa</artifactId> in pom.xml
<artifactId>spring-boot-starter-data-jpa</artifactId> here i addedd
is it possible for you to share entire code base via github? I can't think of anything else from top of my head. Maybe after looking at entire code base, I might be able to help.
Before that, can you try renaming the driver-property name as spring.datasource.driverClassName
n: The server time zone value 'unknown' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the 'serverTimezone' configuration property) to use a more specifc time zone value if you want to utilize time zone support.
|
0

You can try adding driver class in application.properties

spring.datasource.driver-class-name=com.mysql.jdbc.Driver

You can also add the following and modify as per your need

spring.jpa.database-platform = org.hibernate.dialect.MySQL5Dialect
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto = update

1 Comment

spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.url=jdbc:mysql://localhost:3306/mlab spring.datasource.username=root spring.datasource.password= i added this sames error

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.