aws/aws-secretsmanager-jdbc

flyway and secretmanager-jdbc does not work together

cshekhar786 opened this issue · 6 comments

Caused by: org.flywaydb.core.api.FlywayException: Invalid JDBC URL (should start with jdbc:) : jdbc-secretsmanager:mysql://localhost:5022/transaction_summary?serverTimezone=UTC
at org.flywaydb.core.internal.util.jdbc.DriverDataSource.detectFallbackUrl(DriverDataSource.java:169)
at org.flywaydb.core.internal.util.jdbc.DriverDataSource.(DriverDataSource.java:119)
at org.flywaydb.core.Flyway.setDataSource(Flyway.java:1014)
at org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$FlywayConfiguration.flyway(FlywayAutoConfiguration.java:143)
at org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$FlywayConfiguration$$EnhancerBySpringCGLIB$$1182d741.CGLIB$flyway$0()
at org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$FlywayConfiguration$$EnhancerBySpringCGLIB$$1182d741$$FastClassBySpringCGLIB$$9c6197e8.invoke()
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:365)
at org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$FlywayConfiguration$$EnhancerBySpringCGLIB$$1182d741.flyway()
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
... 26 common frames omitted

After going through flyway source code ,i found that flyway have validation for jdbc url .

Flyway jar:flyway-core-6.0.4.jar
ClassName:DriverDataSource

private String detectFallbackUrl(String url)
{
if (!StringUtils.hasText(url))
{
String boxfuseDatabaseUrl = System.getenv("BOXFUSE_DATABASE_URL");
if (StringUtils.hasText(boxfuseDatabaseUrl)) {
return boxfuseDatabaseUrl;
}
throw new FlywayException("Missing required JDBC URL. Unable to create DataSource!");
}
if (!url.toLowerCase().startsWith("jdbc:")) {
throw new FlywayException("Invalid JDBC URL (should start with jdbc:) : " + url);
}
return url;
}

It would be nice if it used a prefix like the opentracing-jdbc project, where it's jdbc:tracing:mysql://localhost:3306/test

Regarding the PR put into Flyway flyway/flyway#2780:

As @will-sargent-eero says, we'd prefer if Amazon would just update their driver to use the more common jdbc prefix. The driver should play nice with existing conventions. We don't really want to maintain this knowledge within the Flyway codebase.

Thank you for opening this issue - we are looking into it.

Its working with flyway 7

Thank you for opening this case!

I'm confirming this works with flyway 9 and am closing this as an issue. Feel free to open a new case if you feel this has been in error.