问题
I have been using H2 database in Corda demo application, I would like to know, if we can plug-in some other relatioal database such as Oracle, Sybase etc instead of H2 database.
If yes, please share relevent link to do the same.
Thanks
回答1:
Yes it is possible to use other databases - for example we have accepted and merged a community contribution to use PostgreSQL: https://github.com/corda/corda/pull/1525 .
However, at this stage, we are only supporting other relational databases in the commercial version of Corda.
回答2:
As of V2 and V3, Corda allows 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
- The value of
database.schema
is not wrapped in double quotes and Postgres always treats it as a lower-case value (e.g.AliceCorp
becomesalicecorp
)
来源:https://stackoverflow.com/questions/48098008/replacing-h2-database-with-some-other-relational-database-in-corda