Installing HAKOM TSM on Microsoft SQL Server
Requirements
The system requirements are documented here: System Requirements
SQL Server Management Studio
Depending on whether a new HAKOM database is to be created or an existing one is to be updated, the sections New installation and Update must be selected. The new installation deals with the basic new installation of a HAKOM DB. The update describes the updating of an existing HAKOM DB to a higher version. Target versions are 3.8.0 or higher.
Path to install package
All neccessary scripts for SQL Server can be found under the following path: HAKOM TSM Standard_3.9.x.x\_Database Scripts
\SQLServer
New Installation
Creating a New Database
The creation of the databases must be performed by a database administrator.
Executing the scripts
- Place the "HAKOM TSM Standard_3.8.x.x" Package in a local folder.
- Navigate to folder
...\Database Scripts\SQLServer\_specific scripts\
Open file
configuration.ini
and set the following variables:TEXT;Insert initial data [true/false] insertData=true ;Add protocol package [true/false] addProtocolPackage=true ;Full server name: serverFullName=hostname,1433 ;ZAMS database name (time series data): dbZAMSName=TSM_DBNAME ;ACL database name (access control list): dbACLName=ACL_DBNAME ;DB-Login Data dbLoginName=username dbLoginPassword=pwd
- Run the batch file at:
...\Database Scripts\SQLServer\_specific scripts\CreateDB_initial_3_8_0_to_latest.cmd
Milliseconds support
To activate time series with intervals less than one second, a change must be made to all databases used by the TSM during installation. The database contains the function CA_InternalTimeUnit. It returns a fixed value:
- 0, seconds, beginn: 1972-01-01T00:00:00+01:00
- 1 (default), seconds, beginn: 1970-01-01T00:00:00Z
- 2, milliseconds, beginn: 1970-01-01T00:00:00Z
On SQL Server the above function can be found under: "Programmability" → "Functions" → "Scalar-valued Functions"
The return value of the above function must be altered with the according numeric representation of the required time unit.
ALTER FUNCTION [dbo].[CA_InternalTimeUnit] ()
RETURNS smallint
AS
BEGIN
--0: Seconds, HAKOM-Time
--1: Seconds, Epoch-Time
--2: Millisecond, Epoch-Time
RETURN 0
END
Update
Preparation
At first the current database version of ACL, FW, Protocol and TSM objects has to be checked. To do that, check the entries of the table DBVERSION. The interpretation of the entries is explained in the following example:
- Table DBVERSION:
ID | NAME | DESCRIPTION | CREATIONDATE | REVISION | PATCH | MAJOR | MINOR |
---|---|---|---|---|---|---|---|
1 | HAKOM TSM | Initialscript | 01.07.2020 | 0 | 0 | 3 | 8 |
2 | HAKOM Framework | - | 01.07.2020 | 4 | 0 | 3 | 8 |
- Interpretation:
Version HAKOM TSM 3.8.0.0
Version HAKOM Framework 3.8.4.0
Manual check scripts
Before the update scripts are installed, it is important to check if manual check scripts have to be installed. You can find them under ...\Database Scripts\SQLServer\V3.8.x\V3.8.x.x\_manual check scripts
and if necessary, import them into SQL Server Management Studio and follow the instructions as described in the scripts.
Executing the scripts
- In
...\Database Scripts\SQLServer
navigate to next higher version as currently installed. Run the scripts one by one in SQL Server Management Studio.
Correct assignment of the scripts to the according database schemas
ACL DB HAKOM_Acl.sql HAKOM_Framework_Protocol ZAMS DB HAKOM_Framework.sql HAKOM_Framework_Index.sql HAKOM_Framework_xxx.sql HAKOM_TSM.sql HAKOM_Framework_Protocol - In
HAKOM TSM Standard_3.3.8.x\Database Scripts\SQLServer
navigate to next higher version as currently installed. - Run the scripts one by one in SQL Server Management Studio.
Additional Information
Due to a bug in SQLServer 2019, you may experience errors when using some functions. Until the bug is fixed by the manufacturer, you can prevent the problem by making the following setting in the database:
ALTER DATABASE SCOPED CONFIGURATION SET TSQL_SCALAR_UDF_INLINING = OFF;
Further information on the subject can be found here: https://feedback.azure.com/forums/908035-sql-server/suggestions/39014263-functions-return-strings-in-else-if-are-cut-depen