与SQL Server 17的Corda数据库连接失败

时间:2018-09-27 09:06:12

标签: corda

尝试将Corda v3.3连接到SQL Server 2017时遇到此错误。

 Could not find method dataSourceProperties() for arguments [build_b58g7zpxmgi2o4qynsvg23rrl$_run_closure7$_closure18$_closure22@6e5d745d] on object of type
net.corda.plugins.Node.

deployNodes代码段为

dataSourceProperties {
        dataSourceClassName ("com.microsoft.sqlserver.jdbc.SQLServerDataSource")
        dataSource.url  ("jdbc:sqlserver://localhost:1433;databaseName=testdb")
        dataSource.user (testuser)
        dataSource.password  (123)
    }
    database {
        transactionIsolationLevel (READ_COMMITTED)

    }
    jarDirs = [".../Microsoft JDBC Driver 6.2 for SQL Server/sqljdbc_6.2/enu/"]

1 个答案:

答案 0 :(得分:1)

您正在将deployNodes的语法与node.conf节点配置文件的语法混淆。

如果要在deployNodes中添加其他配置选项并将其复制到节点的node.conf文件中,则需要使用extraConfig,如下所示:

task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
    directory "./build/nodes"
    node {
        name "O=PartyA,L=London,C=GB"
        p2pPort 10007
        rpcSettings {
            address("localhost:10008")
            adminAddress("localhost:10048")
        }
        cordapps = ["$corda_release_group:corda-finance:$corda_release_version"]
        rpcUsers = [[user: "user1", "password": "test", "permissions": ["ALL"]]]
        extraConfig = [
                dataSourceProperties: [
                        dataSourceClassName: 'com.microsoft.sqlserver.jdbc.SQLServerDataSource',
                        dataSource         : [
                                url     : 'jdbc:sqlserver://localhost:1433;databaseName=testdb',
                                user    : 'testuser',
                                password: '123'
                    ]
                ],
                database            : [transactionIsolationLevel: 'READ_COMMITTED'],
                jarDirs             : ['.../Microsoft JDBC Driver 6.2 for SQL Server/sqljdbc_6.2/enu/']
        ]
    }
}