This shows you the differences between two versions of the page.

Link to this comparison view

h2databasetcpserver [2016/03/06 19:46]
pela [View graphs]
h2databasetcpserver [2018/11/03 02:59]
Line 1: Line 1:
-====== H2DatabaseTCPServer ====== 
-This module is a part of the [[:​start|NetHomeServer]]. The H2DatabaseTCPServer connects with a local H2 TCP Database and will open up connectivity to store and read values from a H2 database. 
-The item is used in storing value item logs written by other home items such as thermometers and hygrometers. It is also used to retrieve data when viewing graphs from a home item. 
-H2 Database is integrated with NetHomeServer. A future version may support remote H2 Database instances. 
-See also discussion below on how to configure global logging to the database. 
-===== Displayed values ===== 
-The readonly values displayed at the top shows the outcome of the configuration. 
-  * **TCP ConnectionString** shows the internal address to the database server, for example //​jdbc:​h2:​tcp:////​​9092/​[data file name]// 
-  * **TCP Status** shows the status of the database server, for example //Running, remotes can connect// 
-  * **WEB ConnectionString** shows the address to the web console. Depending on the **WEB public** setting this value may show as http://​​8082 or http://​​8082 when not available publicly, or https://​​8082 public. 
-  * **WEB Status** shows the status of the web console, for example //Running, remotes can connect// or //Not running - check logs// if the server has not been started. 
-Note, the web connection string may show https for public access but you may still not be able to access the console. This is because the home item can't know if the SSL is enabled or not. If so, access the web console using http and preferably change via preferences to use SSL (Use encrypted SSL (HTTPS) connections). ​ 
-===== Functions ===== 
-  * Start and Stop TCP Service is for the H2 Database server itself. 
-  * Start and Stop Web Service is for the H2 web console itself. 
-===== Settings ===== 
-These settings are available in the home item: 
-  * **Item name** is whatever name you would like to call the new item, for example "​H2DatabaseServer"​. 
-  * **DatabasePath** is the location on your NetHomeServer installation where H2 can access the database. Enter a "​~"​ (tilde) character for the current users directory. On a Raspberry Pi installation (Linux) this is the user NetHome'​s directory at /​home/​nethome. 
-  * **TCP active on startup** when checked will activate the H2 database server on startup of NetHomeServer. 
-  * **TCP Port** is the internal port for accessing the H2 database console. 
-  * **WEB active on startup** when checked will activate the H2 web console on startup of NetHomeServer. 
-  * **WEB Port** is the public port for accessing the H2 web console. 
-  * **WEB public** when checked will make the H2 web console made available to the public - they will still have to log in though. If unchecked will only allow connections locally to the web console (on the same machine, localhost,, etc). 
-//Note: You may have to stop and start the service(s) if you change any of the settings.// 
-====== Configure global logging to the database ====== 
-Following these steps will enable global logging of all value items to the database. ​ 
-In this example the database will be named **nhs_values** and created with a user named **sa** and the password will be set to **SuperSecretPa$$w0rd**. 
-  - Go to the Settings page and enter a GlobalLogger value as **jdbc:​h2:​tcp:////​localhost/​nhs_values;​USER=sa;​PASSWORD=SuperSecretPa$$w0rd** 
-  - Create the H2DatabaseServer home item. It is located in the Ports section. Fill in the fields as explained previously 
-  - Make sure the H2DatabaseServer is enabled 
-The Log view will display additional information about the logging activity. 
-Note! Always use a hard to guess password if you intend to have the Web console public. 
-The **jdbc:​h2:​tcp:​** part is needed to enable the database functionality. 
-===== Change user and password ===== 
-(Un)fortunately it is not easy to change the user name and password. 
-If you need to do this, simply provide a new database name and new credentials. 
-Re-import the text log files as is explained next. 
-===== Import text log files ===== 
-There is an import function that will let NetHomeServer import every text log file of all home items into the database. 
-It expects the home items to have a **LogFile** configured so that the file can be found, or otherwise the item will be skipped. 
-   - Go to the Settings page and click the **Update Global Logger** button 
-   - The import will start and it can take some time before all values have been imported. 
-   - View and periodically refresh the Log page for progress of the import. ​ 
-====== View graphs ====== 
-When you want to view graphs of the logged data, click the **View graph...** link for the home item. 
-Please note that the database server will cache the result on successive views. This means that the first view will take slightly longer but successive views will be faster. This is in any case several times faster than reading the logs from the text files. 
-==== See also ==== 

Personal Tools