Domanda

I'm very new to using flyway and currently I'm trying to create database migrations using it for sql sever. We use Gradle in our project, so I'm trying to use the flyway plugin for gradle.

I have downloaded the JDBC driver for sql server from here : http://www.microsoft.com/en-us/download/confirmation.aspx?id=11774

This is how my gradle flyway task looks like:

flyway {
    driver = 'com.microsoft.sqlserver.jdbc.SQLServerDriver'
    url = 'jdbc:microsoft:sqlserver://localhost:1433;Databasename=testing'
    user = 'testdev'
    password = 'testdev'
}

The exception I'm getting when I execute 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

Let me know what I'm missing here.

Thanks.

È stato utile?

Soluzione

Yes, I had added the dependency for SQLServerDriver. I found the fix, was using the incorrect url, the correct one is: url = 'jdbc:sqlserver://localhost:1433;Databasename=testing'

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top