无法从数据源获取JDBC连接

时间:2013-04-20 07:05:46

标签: mysql sql jdbc gradle

我试图在gradle中运行以下命令,它给了我以下错误:

    c:\gsoc\mifosx\mifosng-provider>gradle migrateTenantListDB -PdbName=mifosplatfor
m-tenants
Listening for transport dt_socket at address: 8005
:migrateTenantListDB FAILED

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\gsoc\mifosx\mifosng-provider\build.gradle' line: 357

* What went wrong:
Execution failed for task ':flywayMigrate'.
> Unable to obtain Jdbc connection from DataSource

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.

BUILD FAILED

Total time: 13.843 secs

脚本文件在这里,行号为。错误显示为357但我不知道为什么它显示我的错误。在mysql服务器中是否有关于错误配置的问题请在这里帮助我: 脚本:

task migrateTenantListDB<<{
    description="Migrates a Tenant List DB. Optionally can pass dbName. Defaults to 'mifosplatform-tenants' (Example: -PdbName=someDBname)"

    def filePath = "filesystem:$projectDir" + System.properties['file.separator'] + '..' + System.properties['file.separator'] + 'mifosng-db' + System.properties['file.separator'] + 'migrations/list_db'
    def tenantsDbName = 'mifosplatform-tenants';
    if (rootProject.hasProperty("dbName")) {
        tenantsDbName = rootProject.getProperty("dbName")
    }

    flyway.url= "jdbc:mysql://localhost:3306/$tenantsDbName"
    flyway.locations= [filePath]

    flywayMigrate.execute()
}

1 个答案:

答案 0 :(得分:0)

这个项目的gradle脚本已经将mysql密码硬编码到mysql。您需要将localhost密码设置为mysql并在尝试此命令之前检查连接。

相关问题