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?
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:
database.schema
property is optional. It represents the database's namespacedatabase.schema
is not wrapped in double quotes and Postgres always treats it as a lower-case value (e.g. AliceCorp
becomes alicecorp
)If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With