Optionally, you can create a connection to a database that saves your incoming data so that you can view your data metrics over a specified period of time in your various solution package displays. You can use the default Historian database (HSQLDB) that is delivered with the DataServer, you can create a connection to RTView Central's Historian database, or you can create a connection to a (supported) database of your choice. This document describes how to set up your database as well as how to modify some additional Historian default settings.
Regardless of which type of database you want to use, you must perform the following steps.
default . historian runhist -ds
If you want to use the default database, perform the following steps:
default . database rundb
No further steps are needed. Your default database is ready to go.
Perform the following steps to create the connection to RTView Central's Historian database:
The Edit Connection window displays.
Note: You can click on the Copy to clipboard and Paste links below the "edit box" prior to creating the connection to automatically include the default text into the window.
URL: The complete URL for RTView Central's database connection.
Driver: The full name for the driver.
Classpath: The complete classpath for the jar location.
Username: The username is used when creating the connection. This field is optional.
Password: This password is used when creating the connection. This field is optional. By default, the password entered is hidden. Click the icon to view the password text.
Run Queries Concurrently: When selected, database queries are run concurrently.
If you do not want to use RTView Central's Historian database or the default/delivered database (HSQLDB), you can create a connection to your (supported) database. For this flow, you will need to install the database of your choice, configure the connections in the RTView Configuration Application, and you will have to manually create the required database tables. To define the connection:
NOTE: The default page size of DB2 is 4k. However, you are required to create a DB2 database with a page size of 8k so that table indexes will function properly.
The Edit Connection window displays.
Note: You can click on the Copy to clipboard and Paste links below the "edit box" prior to creating the connection to automatically include the default text into the window.
URL - Enter the full database URL to use when connecting to this database using the specified JDBC driver.
Driver - Enter the fully qualified name of the JDBC driver class to use when connecting to this database.
Classpath - Enter the location of the jar where the JDBC driver resides in your environment.
Username - Enter the username to enter into this database when making a connection.
Password - Enter the password to enter into this database when making a connection. If there is no password, use “-“.
Run Queries Concurrently - Select this check box to run database queries concurrently.
Click Save in the RTView Configuration Application and restart your data server.
To create tables for your database, use the .sql template files provided for each supported database platform, which is located in the dbconfig directory of the common, <solution package>, and rtvmgr directories:
rtvapm/<solution package>/dbconfig/create_<solution package>_history_tables_<db>.sql
rtvapm/rtvmgr/dbconfig/create_rtvmgr_history_tables_<db>.sql
where <db> ={db2, mysql, oracle, sqlserver, sybase}
NOTE: The standard SQL syntax is provided for each database, but requirements can vary depending on database configuration. If you require assistance, consult with your database administrator.
The most effective method to load the .sql files to create the database tables depends on your database and how the database is configured. Some possible mechanisms are:
Interactive SQL Tool
Some database applications provide an interface where you can directly type SQL commands. Copy/paste the contents of the appropriate .sql file into this tool.
Import Interface
Some database applications allow you to specify a .sql file containing SQL commands. You can use the .sql file for this purpose.
Before loading the .sql file, you should create the database and declare the database name in the command line of your SQL client. For example, on MySQL 5.5 Command Line Client, you should first create the database to create the tables for the Historian Settings:
create database myDBName;
Before loading the .sql file:
mysql -u myusername -mypassword myDBName < create_common_rtvhistory_tables_mysql.sql;
In some cases it might also be necessary to split each of the table creation statements in the .sql file into individual files.
Third Party Application
If your database does not have either of the two above capabilities, a third party tool can be used to enter SQL commands or import .sql files. Third party tools are available for connecting to a variety of databases (RazorSQL, SQLMaestro, Toad, for example).
You can also modify the default historian settings on the Historian tab for the following properties:
Note: Use caution when you change the Initial Memory and Max Memory allocations. If the memory allocation is too small, the server might crash during startup and, if it is too large, the server might eventually exceed the available CPU/memory and fail.
Initial Memory: The initial amount of memory to allocate for this process. Specify a number followed by a unit. Units are k (kilobyte), m (megabyte), g (gigabyte). If no unit is used, the number is assumed to be bytes.
Max Memory: The maximum amount of memory to allocate for this process. Specify a number followed by a unit. Units are k (kilobyte), m (megabyte), g (gigabyte). If no unit is used, the number is assumed to be bytes.
Logs > Log File: The log file name and location relative to the startup directory for this process. In the Log File field, use the following format: <directory name>/<log file name>. For example, logs/historian.log.