corda/docs/source/node-database.rst
Joel Dudley 286dc7b77d
Joel upgrade docs (#3730)
* Instructions on how to perform H2 DB upgrades without starting the node.

* Formatting error. Adds required subsections in H2 docs.

* Merges duplicated information about H2 DB access.

* Drops script references for now.

* Clarifies upgrade notes.

* Better title.

* Inr

* Addresses review comments.

* Addresses review comments.
2018-08-03 13:34:34 +01:00

2.5 KiB

Node database

Default in-memory database

By default, nodes store their data in an H2 database. See node-database-access-h2.

PostgreSQL

Nodes can also be configured to use PostgreSQL 9.6, using PostgreSQL JDBC Driver 42.1.4.

Warning

This is an experimental community contribution. The Corda continuous integration pipeline does not run unit tests or integration tests of this feature.

Configuration

Here is an example node configuration 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]
}

Note that:

  • The database.schema property is optional
  • 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)
  • If you provide a custom database.schema, its value must either match the dataSource.user value to end up on the standard schema search path according to the PostgreSQL documentation, or the schema search path must be set explicitly for the user.

SQLServer

Nodes also have untested support for Microsoft SQL Server 2017, using Microsoft JDBC Driver 6.2 for SQL Server.

Warning

This is an experimental community contribution, and is currently untested. We welcome pull requests to add tests and additional support for this feature.

Configuration

Here is an example node configuration for SQLServer:

dataSourceProperties = {
    dataSourceClassName = "com.microsoft.sqlserver.jdbc.SQLServerDataSource"
    dataSource.url = "jdbc:sqlserver://[HOST]:[PORT];databaseName=[DATABASE_NAME]"
    dataSource.user = [USER]
    dataSource.password = [PASSWORD]
}
database = {
    transactionIsolationLevel = READ_COMMITTED
    schema = [SCHEMA]
}
jarDirs = ["[FULL_PATH]/sqljdbc_6.2/enu/"]

Note that:

  • The database.schema property is optional and is ignored as of release 3.1.
* Ensure the directory referenced by jarDirs contains only one JDBC driver JAR file; by the default,

sqljdbc_6.2/enu/contains two JDBC JAR file for different Java versions.