Solucionado (ver solução)
Solucionado
(ver solução)
4
respostas

intellij não encontra a database de novo

Na primeira vez que eu fiz deu certo, eu rodei e compilou tudo certinho, mas agora que eu abri de novo e rodei ta dando o erro da database não existir.

Já acessei o mysql e o vollmed_api tá lá.

4 respostas

Oi Thiago,

Posta aqui o erro que está acontecendo e seu arquivo application.properties

2022-12-01T09:37:08.429-03:00 WARN 19628 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Unable to obtain connection from database: Unknown database 'vollmed-api'

SQL State : 42000 Error Code : 1049 Message : Unknown database 'vollmed-api'

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled. 2022-12-01T09:37:08.465-03:00 ERROR 19628 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Unable to obtain connection from database: Unknown database 'vollmed-api'

SQL State : 42000 Error Code : 1049 Message : Unknown database 'vollmed-api'

Caused by: java.sql.SQLSyntaxErrorException: Unknown database 'vollmed-api' at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120) ~[mysql-connector-j-8.0.31.jar:8.0.31] at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) ~[mysql-connector-j-8.0.31.jar:8.0.31] at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:828) ~[mysql-connector-j-8.0.31.jar:8.0.31] at com.mysql.cj.jdbc.ConnectionImpl.(ConnectionImpl.java:448) ~[mysql-connector-j-8.0.31.jar:8.0.31] at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:241) ~[mysql-connector-j-8.0.31.jar:8.0.31] at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198) ~[mysql-connector-j-8.0.31.jar:8.0.31] at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138) ~[HikariCP-5.0.1.jar:na] at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:359) ~[HikariCP-5.0.1.jar:na] at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201) ~[HikariCP-5.0.1.jar:na] at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:470) ~[HikariCP-5.0.1.jar:na] at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561) ~[HikariCP-5.0.1.jar:na] at com.zaxxer.hikari.pool.HikariPool.(HikariPool.java:100) ~[HikariCP-5.0.1.jar:na] at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) ~[HikariCP-5.0.1.jar:na] at org.flywaydb.core.internal.jdbc.JdbcUtils.openConnection(JdbcUtils.java:48) ~[flyway-core-9.5.1.jar:na] ... 29 common frames omitted

aplication.properties: https://cdn1.gnarususercontent.com.br/1/817535/c42348f1-dd8a-4441-b66e-8c4c64633b57.png

Sendo que a vollmed_api tá lá https://cdn1.gnarususercontent.com.br/1/817535/d4c7ba1f-042e-4e0c-8192-5703919255d0.png)

solução!

Acho que o problem é porque você criou o banco com underline(vollmed_api) mas no projeto está com hífen(vollmed-api)

caramba, era isso memso. desatenção minha aqui, valeu!