2017-07-21 11:33:31 +00:00
|
|
|
Node database
|
|
|
|
=============
|
|
|
|
|
2017-11-22 12:28:38 +00:00
|
|
|
Default in-memory database
|
|
|
|
--------------------------
|
2018-02-26 14:53:13 +00:00
|
|
|
By default, nodes store their data in an H2 database. You can connect directly to a running node's database to see its
|
|
|
|
stored states, transactions and attachments as follows:
|
2017-07-21 11:33:31 +00:00
|
|
|
|
|
|
|
* Download the `h2 platform-independent zip <http://www.h2database.com/html/download.html>`_, unzip the zip, and
|
|
|
|
navigate in a terminal window to the unzipped folder
|
2018-02-26 14:53:13 +00:00
|
|
|
* Change directories to the bin folder: ``cd h2/bin``
|
2017-07-21 11:33:31 +00:00
|
|
|
|
|
|
|
* Run the following command to open the h2 web console in a web browser tab:
|
|
|
|
|
|
|
|
* Unix: ``sh h2.sh``
|
|
|
|
* Windows: ``h2.bat``
|
|
|
|
|
|
|
|
* Find the node's JDBC connection string. Each node outputs its connection string in the terminal
|
|
|
|
window as it starts up. In a terminal window where a node is running, look for the following string:
|
|
|
|
|
|
|
|
``Database connection URL is : jdbc:h2:tcp://10.18.0.150:56736/node``
|
|
|
|
|
|
|
|
* Paste this string into the JDBC URL field and click ``Connect``, using the default username and password.
|
|
|
|
|
|
|
|
You will be presented with a web interface that shows the contents of your node's storage and vault, and provides an
|
2017-11-22 12:28:38 +00:00
|
|
|
interface for you to query them using SQL.
|
|
|
|
|
|
|
|
Standalone database
|
|
|
|
-------------------
|
|
|
|
|
|
|
|
To run a node against a remote database modify node JDBC connection properties in `dataSourceProperties` entry
|
2018-01-13 11:00:01 +00:00
|
|
|
and Hibernate properties in `database` entry - see :ref:`Node configuration <database_properties_ref>`.
|
|
|
|
|
2018-01-25 13:38:51 +00:00
|
|
|
Corda will search for valid JDBC drivers either under the ``./plugins`` subdirectory of the node base directory or in one
|
|
|
|
of the paths specified by the ``jarDirs`` field of the node configuration. Please make sure a ``jar`` file containing drivers
|
|
|
|
supporting the database in use is present in one of these locations.
|
2017-11-22 12:28:38 +00:00
|
|
|
|
|
|
|
SQL Azure and SQL Server
|
|
|
|
````````````````````````
|
2018-01-25 13:38:51 +00:00
|
|
|
Corda has been tested with SQL Server 2017 (14.0.3006.16) and Azure SQL (12.0.2000.8), using Microsoft JDBC Driver 6.2.
|
2018-01-13 11:00:01 +00:00
|
|
|
The minimum transaction isolation level ``database.transactionIsolationLevel`` is 'READ_COMMITTED'.
|
2017-11-22 12:28:38 +00:00
|
|
|
The property ``database.schema`` is optional.
|
|
|
|
|
|
|
|
Example node configuration for SQL Azure:
|
|
|
|
|
2018-01-25 13:38:51 +00:00
|
|
|
.. sourcecode:: groovy
|
2017-11-22 12:28:38 +00:00
|
|
|
|
2018-01-13 11:00:01 +00:00
|
|
|
dataSourceProperties {
|
|
|
|
dataSourceClassName = "com.microsoft.sqlserver.jdbc.SQLServerDataSource"
|
|
|
|
dataSourceProperties.dataSource.url = "jdbc:sqlserver://[DATABASE_SERVER].database.windows.net:1433;databaseName=[DATABASE];
|
|
|
|
encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30"
|
|
|
|
dataSourceProperties.dataSource.user = [USER]
|
|
|
|
dataSourceProperties.dataSource.password = [PASSWORD]
|
|
|
|
}
|
|
|
|
database {
|
|
|
|
transactionIsolationLevel = READ_COMMITTED
|
|
|
|
schema = [SCHEMA]
|
|
|
|
}
|
2018-01-25 13:38:51 +00:00
|
|
|
jarDirs = [PATH_TO_JDBC_DRIVER_DIR]
|
2018-01-08 14:05:42 +00:00
|
|
|
|
2018-01-29 18:35:58 +00:00
|
|
|
Oracle
|
|
|
|
````````````````````````
|
|
|
|
Corda supports Oracle 11g RC2 and Oracle 12c with ojdbc6.jar driver..
|
|
|
|
The minimum transaction isolation level ``database.transactionIsolationLevel`` is 'READ_COMMITTED'.
|
|
|
|
The property ``database.schema`` is optional.
|
|
|
|
|
|
|
|
Example node configuration for Oracle:
|
|
|
|
|
|
|
|
.. sourcecode:: none
|
|
|
|
|
|
|
|
dataSourceProperties = {
|
|
|
|
dataSourceClassName = "oracle.jdbc.pool.OracleDataSource"
|
|
|
|
dataSource.url = "jdbc:oracle:thin:@[IP]:[PORT]:xe"
|
|
|
|
dataSource.user = [USER]
|
|
|
|
dataSource.password = [PASSWORD]
|
|
|
|
}
|
|
|
|
database = {
|
|
|
|
transactionIsolationLevel = READ_COMMITTED
|
|
|
|
schema = [SCHEMA]
|
|
|
|
}
|
|
|
|
jarDirs = [PATH_TO_JDBC_DRIVER_DIR]
|
|
|
|
.. _postgres_ref:
|
|
|
|
|
2018-01-08 14:05:42 +00:00
|
|
|
PostgreSQL
|
|
|
|
````````````````````````
|
2018-01-25 13:38:51 +00:00
|
|
|
Corda has been tested on PostgreSQL 9.6 database, using PostgreSQL JDBC Driver 42.1.4.
|
|
|
|
The property ``database.schema`` is optional. The value of ``database.schema`` is automatically wrapped in double quotes
|
|
|
|
to preserve case-sensitivity (e.g. `AliceCorp` becomes `"AliceCorp"`, without quotes PostgresSQL would treat the value as `alicecorp`).
|
2018-01-08 14:05:42 +00:00
|
|
|
|
|
|
|
Example node configuration for PostgreSQL:
|
2018-02-27 12:00:57 +00:00
|
|
|
=======
|
2018-02-26 14:53:13 +00:00
|
|
|
PostgreSQL
|
|
|
|
----------
|
2018-02-27 14:44:17 +00:00
|
|
|
Nodes also support PostgreSQL 9.6, using PostgreSQL JDBC Driver 42.1.4.
|
2018-02-26 14:53:13 +00:00
|
|
|
|
|
|
|
Configuration
|
|
|
|
~~~~~~~~~~~~~
|
|
|
|
Here is an example node configuration for PostgreSQL:
|
2018-01-08 14:05:42 +00:00
|
|
|
|
2018-01-25 13:38:51 +00:00
|
|
|
.. sourcecode:: groovy
|
2018-01-08 14:05:42 +00:00
|
|
|
|
2018-01-13 11:00:01 +00:00
|
|
|
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]
|
2018-01-25 13:38:51 +00:00
|
|
|
}
|
|
|
|
jarDirs = [PATH_TO_JDBC_DRIVER_DIR]
|
2018-02-26 14:53:13 +00:00
|
|
|
|
|
|
|
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
|
2018-02-27 12:00:57 +00:00
|
|
|
(e.g. ``AliceCorp`` becomes ``alicecorp``)
|