Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

corda

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 database?

like image 703
Joel Avatar asked Mar 07 '23 02:03

Joel


1 Answers

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)
like image 78
Joel Avatar answered May 16 '23 17:05

Joel