1
resposta

Erro ao tentar conectar com mariaDB spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MariaDBDialect

Boa noite, estou estudando e tentando conectar com o maria db, porem, nao estou conseguindo.

Por favor, podem me ajudaR?

Segue

Erro

2022-08-16 19:04:18.835  WARN 3048 --- [  restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/sql/init/DataSourceInitializationConfiguration.class]: Unsatisfied dependency expressed through method 'dataSourceScriptDatabaseInitializer' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
2022-08-16 19:04:18.838  INFO 3048 --- [  restartedMain] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2022-08-16 19:04:18.859  INFO 3048 --- [  restartedMain] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-08-16 19:04:18.887 ERROR 3048 --- [  restartedMain] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
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).

application.properties

spring.datasource.url=jdbc:mysql://localhost/alura-challenge
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect

spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=create

Valeuu

1 resposta

Oi Vinicius,

As configurações estão corretas.

Verifica se o arquivo application.properties está no diretório src/main/resources e posta aqui o seu pom.xml.