1

We are trying to upgrade our project through build.gradle dependencies :

  • spring-boot from version 1.5.7 to 2.3.3

  • Gradle from version Gradle-4.8-all to Gradle-6.4.1-all

We are getting the following error:

Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is org.flywaydb.core.internal.command.DbMigrate$FlywayMigrateException: 
    Migration V3__Sequence_Table.sql failed
    ---------------------------------------
    SQL State  : 42001
    Error Code : 42001
    Message    : Syntax error in SQL statement "DELIMITER[*]   

The JDBC connection URL was mentioned as below earlier.

o.f.c.internal.database.DatabaseFactory  : Database: jdbc:mysql://xxxxx:3306/mydb (MySQL 5.7)

This has been changed as below now,

o.f.c.internal.database.DatabaseFactory  : Database: jdbc:h2:mem:testdb (H2 1.4)

Is this the cause of the above flyway migration error?

Jagadhees
  • 13
  • 2
  • 2
    Is the SQL Flyway is trying to execute specific to MySQL? The H2 database might not be compatible with all SQL features MySQL has. Looks at this https://stackoverflow.com/questions/53047481/mysql-delimiter-in-h2?noredirect=1&lq=1 and the linked issue. Maybe it helps. – Sebastian Oct 05 '20 at 11:02
  • Thanks, @Sebastian. Tried specifying MYSQL with `spring.datasource.platform=mysql` as mentioned in [https://stackoverflow.com/questions/40247283/spring-boot-mysql-settings-are-not-working]. But it didn't workout. – Jagadhees Oct 05 '20 at 14:30
  • Which database is correct in your project? Are you using MySQL or H2? I cannot reallly follow which one is the correct one. – Sebastian Oct 05 '20 at 15:20
  • yes, It is MySQL. @Sebastian – Jagadhees Oct 05 '20 at 16:59
  • Ok, and you changed the JDBC URL to `jdbc:h2:mem:testdb`? – Sebastian Oct 06 '20 at 06:24
  • NO, we are trying to upgrade the spring boot version. while we run the application in locally it has been taken JDBC: MySQL, when we have deployed into AWS, JDBC URL automatically changed form JDBC: MySQL to JDBC:h2:mem: we need only JDBC: Mysql @Sebastian – Jagadhees Oct 06 '20 at 10:09

1 Answers1

0

problem:

Run command for jar file is a problem for this project `

Dspring.config.location=run.properties this commad execute only run.properties

solution:

Instead of the above run command, you should try this run command for the jar file

  Dspring.config.additional-location=run.properties

I was try for my project and this was working well

Ramesh Raj
  • 36
  • 1
  • 5