// Create a Flyway DbSupport object (based on our connection)
// This is how Flyway determines the database *type* (e.g. Postgres vs Oracle)
DbSupport dbSupport = DbSupportFactory.createDbSupport(connection, false);
// Load our SQL string & execute via Flyway's SQL parser
SqlScript script = new SqlScript(sqlToExecute, dbSupport);
script.execute(dbSupport.getJdbcTemplate());
}
catch(FlywayException fe)
{
// If any FlywayException (Runtime) is thrown, change it to a SQLException
throw new SQLException("Flyway executeSql() error occurred", fe);