corda/docs/source/node-database.rst
szymonsztuka 175bceb5e8
SQL Azure database compatibility (#113)
* Coin selection for SQL Server/Azure
* Transaction isolation level change for updateInfoDB in PersistentNetworkMapCache from "repeatableRead" to "readCommitted"
* Configuration option to prefix all Hibernate generated SQL with a schema name via a configuration property `database.schema`
* Fix negative value in SELECT TOP query (fix for Oracle db)
2017-11-22 12:28:38 +00:00

61 lines
2.3 KiB
ReStructuredText

Node database
=============
Default in-memory database
--------------------------
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:
* 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
* Change directories to the bin folder:
``cd h2/bin``
* 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
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
and Hibernate properties in `database` entry - see `:ref:`dataSourceProperties`.
SQL Azure and SQL Server
````````````````````````
Corda supports SQL Server 2017 adn SQL Azure.
The minimum transaction isolation level ``database.transactionIsolationLevel`` is 'readCommitted'.
The property ``database.schema`` is optional.
Corda ships with Microsoft JDBC Driver 6.2 for SQLServer out-of-the-box.
Example node configuration for SQL Azure:
.. sourcecode:: none
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 = "readCommitted"
schema = [SCHEMA]
}