Using PostgreSQL instead of H2 as the Corda node's database

后端 未结 3 539
走了就别回头了
走了就别回头了 2020-12-16 08:12

I would like to use PostgreSQL instead of H2 as the database for my node. Is using PostgreSQL for Corda nodes possible? How would I configure my node to use a PostgreSQL dat

3条回答
  •  醉梦人生
    2020-12-16 08:42

    Both Corda 2 and Corda 3 allow the use of PostgreSQL 9.6, using PostgreSQL JDBC Driver 42.1.4. Note that this is an experimental community contribution, and is currently untested.

    Here is an example node configuration block for PostgreSQL:

    dataSourceProperties = {
        dataSourceClassName = "org.postgresql.ds.PGSimpleDataSource"
        dataSource.url = "jdbc:postgresql://[HOST]:[PORT]/postgres"
        dataSource.user = [USER]
        dataSource.password = [PASSWORD]
    }
    
    database = {
        transactionIsolationLevel = READ_COMMITTED
        schema = [SCHEMA]
    }
    

    You need to add this block to the node's node.conf file, found at the root of the node folder.

    Note that:

    • The database.schema property is optional. It represents the database's namespace
    • The value of database.schema is not wrapped in double quotes and Postgres always treats it as a lower-case value (e.g. AliceCorp becomes alicecorp)

提交回复
热议问题