0

I am using corda 4.5 with gradle plugin version as 5.0.10 and postgres as my DB. when I am trying to run deployNodes task, getting below error:

[ERROR] 15:51:47+0530 [main] internal.NodeStartupLogging. - Could not find the database driver class. Please add it to the drivers directory. [Error Code: database-missing-driver For further information, please go to https://docs.corda.net/docs/corda-os/4.5/error-codes.html] - Could not find the database driver class. Please add it to the 'drivers' folder. [errorCode=1oswgkz, moreInformationAt=https://errors.corda.net/OS/4.5/1oswgkz]

Following is the deployNode task code in build.gradle file:

    task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
    nodeDefaults {
        projectCordapp {
            deploy = false
        }
        cordapp "$confidential_id_release_group:ci-workflows:$confidential_id_release_version"
        cordapp "$accounts_release_group:accounts-contracts:$accounts_release_version"
        cordapp "$accounts_release_group:accounts-workflows:$accounts_release_version"

        cordapp project(':cordapp-contracts-states')
        cordapp project(':workflows')

        //ext.drivers = ['${rootProject.projectDir}/lib/postgresql-42.2.8.jar']
    }

    //NOTARY NODE

    node {
        name "O=Notary,L=London,C=GB"
        notary = [validating: true]
        p2pAddress("localhost:10002")
        rpcSettings {
            address("localhost:10003")
            adminAddress("localhost:10043")
        }
    }

    // NODEA

    node {
        name "O=NODEA,L=Lucknow,C=IN"

        p2pAddress("localhost:10010")
        rpcSettings {
            address("localhost:10011")
            adminAddress("localhost:10052")
        }
        rpcUsers = [[user: "userA", "password": "user123", "permissions": ["ALL"]]]
        //new DB config
        //DB
        extraConfig = [
                'dataSourceProperties.dataSource.url' : 'jdbc:postgresql://localhost:5432/egdb?currentSchema=nodeA_schema',
                'dataSourceProperties.dataSourceClassName' : 'org.postgresql.ds.PGSimpleDataSource',
                'dataSourceProperties.dataSource.user' : 'postgres',
                'dataSourceProperties.dataSource.password' : 'postgres',
                //'dataSourceProperties.driverClassName' : 'org.postgresql.ds.PGSimpleDataSource'
                //jarDirs = ['${rootProject.projectDir}/lib/postgresql-42.2.8.jar']
                //'drivers' : 'org.postgresql.Driver'
                'jarDirs' : ['${rootProject.projectDir}/lib/jdbc/driver/postgresql-42.2.8.jar']
        ]
        //jarDirs = ['${rootProject.projectDir}/lib/postgresql-42.2.8.jar']
        //drivers = ext.drivers

    }

// NODEB
 node {
        name "O=NODEB,L=Delhi,C=IN"

        p2pAddress("localhost:10010")
        rpcSettings {
            address("localhost:10011")
            adminAddress("localhost:10052")
        }
        rpcUsers = [[user: "userB", "password": "user123", "permissions": ["ALL"]]]
        //new DB config
        //DB
        extraConfig = [
                'dataSourceProperties.dataSource.url' : 'jdbc:postgresql://localhost:5432/egdb?currentSchema=nodeB_schema',
                'dataSourceProperties.dataSourceClassName' : 'org.postgresql.ds.PGSimpleDataSource',
                'dataSourceProperties.dataSource.user' : 'postgres',
                'dataSourceProperties.dataSource.password' : 'postgres',
                //'dataSourceProperties.driverClassName' : 'org.postgresql.ds.PGSimpleDataSource'
                //jarDirs = ['${rootProject.projectDir}/lib/postgresql-42.2.8.jar']
                //'drivers' : 'org.postgresql.Driver'
                'jarDirs' : ['${rootProject.projectDir}/lib/jdbc/driver/postgresql-42.2.8.jar']
        ]
        //jarDirs = ['${rootProject.projectDir}/lib/postgresql-42.2.8.jar']
        //drivers = ext.drivers

    }
}

How to add the postgresql jdbc driver path in build.gradle file? What is the compatible postgresql verion with corda 4.5?

2 Answers 2

5

It resolved the issue for me by adding the following line in build.gradle file in the dependencies section:

cordaDriver "org.postgresql:postgresql:42.2.8"
Sign up to request clarification or add additional context in comments.

1 Comment

This also worked for me on corda 4.6, thanks for sharing!
0

According to this article:

  1. PostgreSQL 9.6 is the lowest acceptable version, the article uses PostgresSQL 11.
  2. The driver version is postgresql-42.1.4.jar.
  3. In order to point your Gradle task to the driver; create a folder (call it drivers), put the driver's jar file inside of it, then inside extraConfig of your node, add drivers = ['absolute_path_to_directory_with_jdbc_driver'] (notice that it's the absolute path to the directory that you created, not the driver file like you did).
  4. Your node configuration is missing database.transactionIsolationLevel, database.schema, and database.runMigration.
  5. Remove jarDirs and add drivers like I mentioned earlier.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.