Historian
Database Setup
The
Historian stores and retrieves data from any database using JDBC. The Historian
communicates with your database using either a direct JDBC connection or
an ODBC-JDBC bridge connection. Both connections require some setup before
the Historian can communicate with your database.
Direct JDBC Connection
Before
the Historian can communicate with your database using a direct JDBC connection,
you must have a JDBC driver for your database. JDBC drivers are available
from most database vendors. Locate the JDBC driver on your machine and
define an environment variable named RTV_USERPATH that includes a path
to the driver class or .jar file that contains the driver class. NOTE:
You may define RTV_USERPATH to include paths to multiple driver classes.
The RTV_USERPATH variable is included in the classpath for Enterprise RTView
and the Historian.
When
you setup the database in the Historian, you must know the fully qualified
class name for the driver class and the database URL required to connect
to your database. The database URL typically contains protocol and sub-protocol
strings for your database, as well as the path to the database and a list
of properties. If you do not know the syntax for your database URL, consult
the documentation for your JDBC driver.
ODBC-JDBC Bridge Connection
Before
the Historian can communicate with your database using an ODBC-JDBC bridge,
you must have an ODBC driver for your database. Most databases that run
on Microsoft Windows come standard with an ODBC driver. You must also register
your database with ODBC before accessing it from Enterprise RTView.
The name specified for the ODBC data source name during the ODBC driver
setup must be RTVHISTORY.
After you have setup your
database, run the Historian and configure the connection in the Database
Options section. Once you have configured the connection, the Historian
will be able to connect to your database. NOTE: If you are using
a direct JDBC connection or a password protected ODBC-JDBC bridge connection
to communicate with the history database, you will need to configure the
history database in the Display Builder before viewing your history data.
To configure the history database in the Display Builder, go to the Application
Options SQL tab and add a database named RTVHISTORY with the same
configuration options used in the Historian. See the SQL Application Options
page in the Data Sources section of this documentation for more information.
History Tables
The Historian archives data
to two history tables in your database: one for numeric data, the other
for string (i.e., textual) data. By default the numeric table is HISTORY
and the string table is HISTORY_S. You can specify your own
history table name (e.g., MY_TABLE)
on the command line for the Historian. The
table name you specify will be used for the numeric table. An _S
will be appended to the table name for the string table (e.g., MY_TABLE_S). NOTE:
Table names cannot contain spaces. If you do
specify your own history table name, you will also need to indicate this
name on the command line for the Display Builder
and Display Viewer Application or in your Display
Viewer Applet parameters.
If these history tables don't
already exist in your database, they will be created for you the first
time you run the Historian. If you do not want the Historian to create
these tables, create your own history tables manually before running the
Historian using the fields described in the table below.
Tabular Data
To
store tabular data, it is recommended that you create a separate history
table in the database. Specify the table name you create in Object Properties
under historyTableName. This table must include a column
for each column in your tabular data element along with two text columns
placed at the end to store time stamp values. If you select the historyTableRowNameFlag
check box in Object Properties, then you must include another text column
placed at the beginning of the table to store row name values. If you choose
not to create a table, then data from your tabular element will be stored
in HISTORY or HISTORY_S and, in the case of tabular data with multiple
columns, row integrity will be lost. NOTE: User defined tables cannot be
used with the valueHistoryFlag
to load initial history data on graph traces. You can view this data in
your display using an SQL data
attachment. For an example of storing tabular data, see the Archiving
and Viewing Historical Data example.
The numeric table (HISTORY
or the table name you specified) should contain numeric information. The
following fields are required:
Field Name |
Field Type |
Field
Description |
Recommended
Field Length (if applicable) |
VAR_NAME |
Text |
The
data attachment used to store this record. |
80-160 |
TIME_STAMP |
Text |
The
time this record was stored. This value is rounded to the closest second. |
30 |
TIME_STAMP_LS |
Text |
A
string value of the time this record was stored. This value contains the
time including milliseconds. |
14 |
VAR_VALUE |
double |
The
value for this field. This value is a number. |
|
The string table (HISTORY_S
or the table name you specified) should contain text information. The following
fields are required:
Field Name |
Field Type |
Field
Description |
Recommended
Field Length (if applicable) |
VAR_NAME |
Text |
The
data attachment used to store this record. |
80-160 |
TIME_STAMP |
Text |
The
time this record was stored. This value is rounded to the closest second. |
30 |
TIME_STAMP_LS |
Text |
A
string value of the time this record was stored. This value contains the
time including milliseconds. |
14 |
VAR_SVALUE |
Text |
The
value for this field. This value is a string. |
40 |
Register
Your Database with ODBC
Windows:
1.
From the Windows Control Panel, double-click on the ODBC Data Sources icon.
If this icon is not listed, double-click on the Administrative Tools icon
and then double-click on the Data Sources (ODBC) icon. This will open the
ODBC dialog.
2.
In the ODBC dialog, click Add. In the Create New Data Source window, select
the driver for which you want to setup a data source. Click Finish to bring
up the Setup dialog.
3.
Enter the following Data Source Name:
RTVHISTORY
4.
Click the Select button and choose the database to which you would like
the Historian to store data.
5.
Click OK in the Select Database, Setup, and ODBC dialogs.
UNIX:
UNIX
systems do not come standard with an ODBC driver. Contact your system administrator
for information on how to install and setup an ODBC driver for your database.
|