我是使用flyway的新手,目前我正在尝试使用它为sql服务器创建数据库迁移。我们在项目中使用Gradle,所以我正在尝试使用flyway插件进行gradle。
我从这里下载了sql server的JDBC驱动程序:http://www.microsoft.com/en-us/download/confirmation.aspx?id=11774
这就是我的gradle flyway任务的样子:
flyway {
driver = 'com.microsoft.sqlserver.jdbc.SQLServerDriver'
url = 'jdbc:microsoft:sqlserver://localhost:1433;Databasename=testing'
user = 'testdev'
password = 'testdev'
}
我执行gradle FlywayInfo时遇到的异常:
Caused by: com.googlecode.flyway.core.api.FlywayException: Unable to obtain Jdbc
connection from DataSource
at com.googlecode.flyway.core.util.jdbc.JdbcUtils.openConnection(JdbcUti
ls.java:52)
at com.googlecode.flyway.core.Flyway.execute(Flyway.java:1174)
at com.googlecode.flyway.core.Flyway.info(Flyway.java:981)
at com.googlecode.flyway.core.Flyway$info.call(Unknown Source)
at com.googlecode.flyway.gradle.task.FlywayInfoTask.run(FlywayInfoTask.g
roovy:31)
at com.googlecode.flyway.gradle.task.FlywayInfoTask$run.callCurrent(Unkn
own Source)
at com.googlecode.flyway.gradle.task.AbstractFlywayTask.runTask(Abstract
FlywayTask.groovy:74)
... 79 more
让我知道我在这里失踪了什么。
感谢。
答案 0 :(得分:2)
是的,我已经添加了SQLServerDriver的依赖项。我发现修复,使用了错误的url,正确的是:url ='jdbc:sqlserver:// localhost:1433; Databasename = testing'