HistorianConnect
Description | Opens a logging connection and controls the lifetime of all resources associated with that connection. |
Warning |
This function should be used only by advanced programmers. The functions, WriteHistory and GetTagHistory and GetLog are recommended for most uses. |
Returns | Invalid if the parameters are invalid, 0 otherwise |
Usage | Script Only. |
Threaded | Yes |
Function Groups | Logging |
Related to: | HistorianDeleteRecords | HistorianGetData | HistorianGetInfo | HistorianReadRecords | HistorianWriteRecords |
Format | HistorianConnect(ConnectionType, ConnectionString, HistorianName, Namespace, HistorianHandle, Error) |
Parameters |
ConnectionType | ||||||
A text keyword that indicates the storage methodology required. Permitted values are
The keywords are not case-sensitive. |
||||||
ConnectionString | ||||||
A text string that provides the information required to connect to the database specified by the ConnectionType. (Non-ASCII characters will be removed.)
|
HistorianName |
An ASCII text string (letters and numbers only) providing the Historian Tag Name. This string is used as part of the full path to a file-based data store and is also the name of the UpTime table in the database. |
Namespace |
The top-level namespace in which to store data (may be an empty string). Non-ASCII characters will be removed. |
HistorianHandle |
Historian Connection handle value. For the VTScada proprietary data store, this will be invalidated on an "out of disk space" error, or on loss of access to the file storage. For other databases, this will be invalidated on any connection loss. |
Error |
A value in which the error code, (if any) will be returned. Defined error codes are provided in the reference chapter. See: Historian Error Codes |
Comments | The connection to the data store is done asynchronously. HistorianHandle will become valid when the connection has been made. If the connection fails Error will be set to some sort of error information. Each separate connection will create its own thread for writing data. Invalidating the connection handle will flush all pending write data and then terminate the thread, DB connections etc. The Namespace parameter may be used to allow the same root storage location to be shared by multiple applications or machines or both. |