使用PostgreSQL代替H2作为Corda节点的数据库 [英] Using PostgreSQL instead of H2 as the Corda node's database

查看:74
本文介绍了使用PostgreSQL代替H2作为Corda节点的数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用PostgreSQL而不是H2作为我的节点的数据库。是否可以将PostgreSQL用于Corda节点?我该如何配置我的节点以使用PostgreSQL数据库?

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?

推荐答案

Corda 2和Corda 3都允许使用PostgreSQL 9.6,使用PostgreSQL JDBC驱动程序42.1.4。请注意,这是社区的实验性贡献,目前尚未经过测试。

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.

以下是PostgreSQL的示例节点配置块:

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]
}

您需要添加此块到节点的 node.conf 文件,该文件位于节点文件夹的根目录。

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

请注意:


  • database.schema 属性是可选的。它表示数据库的命名空间

  • database.schema 的值未用双引号引起来,Postgres始终将其视为较低的-案例值(例如 AliceCorp 变为 alicecorp

  • 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)

这篇关于使用PostgreSQL代替H2作为Corda节点的数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆