Skip to main content
Skip table of contents

Configuring VMS to use a different Microsoft SQL Server

Information regarding how to configure Mirasys VMS to use a different MS SQL Server installation than the default MS SQL Server Express.

Currently is possible to use different names for databases. Before making any modifications you need to stop VMS services; WDServer, SMServer and DVRServer.

If there are any temp files, remove those before starting services again. Because the system may detect that those files are modified and restore data from temp file, which overwrite SQL connection string changes.

Configuring VMS 9.3 forward to use a different Microsoft SQL Server (Older V9.x versions use similar connections that V8.3.x)

  1. Stop services WDServer, DVRServer and SMServer

  2. Browse to C:\Program Files\DVMS\SystemManagement

  3. Edit the System Management database configuration file Database.xml

    1. Data Source = IP address of the remote database

    2. DVMSData:User Id=the database username

    3. Password=the password for the database username

    4. Add Integrated Security=False attribute if you are using username and password. True means Windows authentication.

  4. Set the instance name to match your database (sqlepxress)

  5. Add line Initial Catalog=DvmsData;User Id=sa;Password=test;Integrated Security=False" to the end of <ConnectionString value="Data Source=10.99.100.153;

  6. Edit line <ConnectionString value="Data Source=10.99.100.153;Initial Catalog=DvmsData;User Id=sa;Password=test;Integrated Security=False" />

  7. Do same modifications to the WdDatabase, DvmReportDatabase and FailoverDatabase

XML
<WdDatabase>
<ConnectionString value="Data Source=localhost\sqlexpress;Initial Catalog=DvmsData;User Id=sa;Password=test;Integrated Security=False" />
</WdDatabase>
<DvmReportDatabase>
<ConnectionString value="Data Source=localhost\sqlexpress;Initial Catalog=DvmsData;User Id=sa;Password=test;Integrated Security=False"  />
</DvmReportDatabase>
<FailoverDatabase>
<ConnectionString value="Data Source=localhost\sqlexpress;Initial Catalog=Failover;User Id=sa;Password=test;Integrated Security=False" />
<MaximumFailoverLogEntryRows value="5000" />
</FailoverDatabase>
</Database>

11. Browse to C:\Program Files\DVMS\DVR.

12. Delete dvr.xml.tmp file

13. Edit dvr.xml file. In that file, you need to change the Database connection string.

14. Add below content to the end of the dvr.xml file but before </dina>

XML
<Metadata>
<Database>
<DatabaseName value="RecorderDB" />
<Enabled value="True" />
<ParameterMarker value="@" />
<ProviderType value="System.Data.SqlClient" />
<ConnectionString value="Data Source=localhost\sqlexpress;Initial Catalog=RecorderDB;Integrated Security=True" />
<CreateDatabaseCommand value="CREATE DATABASE RecorderDB"/>
<CreateTablesCommand value="USE RecorderDB CREATE TABLE RecorderMetadata (Id int NOT NULL IDENTITY(1,1) PRIMARY KEY, SourceType int NOT NULL, EventTime bigint NOT NULL, FormatType int NOT NULL, Channel int NOT NULL, MetaData nvarchar(MAX) NULL ) CREATE NONCLUSTERED INDEX IX_RecorderMetadata ON RecorderMetadata ([Channel] ASC, [SourceType] ASC, [FormatType] ASC, [EventTime] ASC)CREATE INDEX IX_EventTime ON RecorderMetadata (EventTime)" />
<InsertCommand value="INSERT INTO RecorderMetadata(SourceType, EventTime, FormatType, Channel, Metadata) VALUES(@SourceType,@EventTime,@FormatType,@Channel,@Metadata)" />
<DeleteRowsCommand value="DELETE FROM RecorderMetadata WHERE EventTime in (SELECT TOP {0} EventTime FROM RecorderMetadata ORDER BY EventTime ASC)" />
</Database>
</Metadata>

15. Modfity the connections string --><ConnectionString value="Data Source=;Initial Catalog=RecorderDB;Integrated Security=False" />

16. Save changes

17. Restart  services WDServer, DVRServer and SMServer

Example configuration of Database.xml

XML
<?xml version="1.0"?>
<Database>
<Enabled value="True" />
<MaximumAlarmEventRows value="100000" />
<MaximumAlarmEventDays value="2147483647" />
<MaximumAuditTrailRows value="2147483647" />
<MaximumAuditTrailDays value="2147483647" />
<MaximumWatchdogEventRows value="100000" />
<MaximumWatchdogEventDays value="2147483647" />
<ProviderType value="System.Data.SqlClient" />
<DvmsDatabaseName value="DvmsData" />
<!-- <ConnectionString value="Data Source=192.168.1.100\INSTANCE,1435;Initial Catalog=DvmsData;User Id=sa;Password=test;Integrated Security=True/False" /> -->
<ConnectionString value="Data Source=localhost\sqlexpress;Initial Catalog=DvmsData;Integrated Security=True" />
<ParameterMarker value="@" />
<Tables>
<AlarmConfig value="AlarmConfig" />
<AlarmAction value="AlarmAction" />
<AlarmEvent value="AlarmEvent" />
<AuditTrail value="AuditTrail" />
</Tables>
<WdDatabase>
<ConnectionString value="Data Source=localhost\sqlexpress;Initial Catalog=WdContext;Integrated Security=True" />
</WdDatabase>
<DvmReportDatabase>
<ConnectionString value="Data Source=localhost\sqlexpress;Initial Catalog=DvmReportContext;Integrated Security=True" />
</DvmReportDatabase>
</Database>

Example configuration of dvr.xml

This need to add in <dina> </dina> section, example end of dvr.xml file and before </dina>

XML
<Metadata>
<Database>
<DatabaseName value="RecorderDB" />
<Enabled value="True" />
<ParameterMarker value="@" />
<ProviderType value="System.Data.SqlClient" />
<ConnectionString value="Data Source=localhost\sqlexpress;Initial Catalog=RecorderDB;Integrated Security=True" />
<CreateDatabaseCommand value="CREATE DATABASE RecorderDB"/>
<CreateTablesCommand value="USE RecorderDB CREATE TABLE RecorderMetadata (Id int NOT NULL IDENTITY(1,1) PRIMARY KEY, SourceType int NOT NULL, EventTime bigint NOT NULL, FormatType int NOT NULL, Channel int NOT NULL, MetaData nvarchar(MAX) NULL ) CREATE NONCLUSTERED INDEX IX_RecorderMetadata ON RecorderMetadata ([Channel] ASC, [SourceType] ASC, [FormatType] ASC, [EventTime] ASC)CREATE INDEX IX_EventTime ON RecorderMetadata (EventTime)" />
<InsertCommand value="INSERT INTO RecorderMetadata(SourceType, EventTime, FormatType, Channel, Metadata) VALUES(@SourceType,@EventTime,@FormatType,@Channel,@Metadata)" />
<DeleteRowsCommand value="DELETE FROM RecorderMetadata WHERE EventTime in (SELECT TOP {0} EventTime FROM RecorderMetadata ORDER BY EventTime ASC)" />
</Database>
</Metadata>

For example to change only database name, following setting will do it:

XML
<Metadata>
<Database>
<DatabaseName value="NewlyNamedRecorderDB" />
</Database>
</Metadata>

Configuring VMS 8. x to use a different Microsoft SQL Server (Up to 8.3.x versions)

  1. Stop services WDServer, DVRServer and SMServer

  2. Browse to C:\Program Files\DVMS\SystemManagement

  3. Edit the System Management database configuration file Database.xml

    1. XML
      <!-- <ConnectionString value="Data Source=192.168.1.100\INSTANCE,1435;Initial Catalog=DvmsData;User Id=sa;Password=test;Integrated Security=True/False" /> -->
    2. XML
      <ConnectionString value="Data Source=localhost\sqlexpress;Initial Catalog=DvmsData;Integrated Security=True" />

  4. Edit SMServer.exe.config file, default location is C:\Program Files\DVMS\SystemManagement.

    XML
    <connectionStrings>
    <!-- <add name="DvmsDataContext" connectionString="Data Source=192.168.1.100\INSTANCE,1435;Initial Catalog=DvmsData;User Id=sa;Password=test;Integrated Security=True/False;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" /> -->
    <add name="DvmsDataContext" connectionString="Data Source=localhost\SQLEXPRESS;Initial Catalog=DvmsData;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
    <add name="WdContext" connectionString="Data Source=localhost\SQLEXPRESS;Initial Catalog=WdContext;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
    </connectionStrings>

  5. Browse to C:\Program Files\DVMS\DVR

  6. Delete dvr.xml.tmp file

  7. Edit the dvr.xml file

  8. Add below content to the end of the dvr.xml

    1. XML
      <Metadata>
      <Database>
      <Enabled value="False" />
      <ParameterMarker value="@" />
      <CreateTablesCommand value="USE RecorderDB CREATE TABLE RecorderMetadata (Id int NOT NULL IDENTITY(1,1) PRIMARY KEY,
      SourceType int NOT NULL, EventTime bigint NOT NULL, FormatType int NOT NULL, Channel int NOT NULL, MetaData varchar(MAX) NULL )
      CREATE NONCLUSTERED INDEX IX_RecorderMetadata ON RecorderMetadata ([Channel] ASC, [SourceType] ASC, [FormatType] ASC, [EventTime] ASC)" />
      <CreateDatabaseCommand value="CREATE DATABASE RecorderDB" />
      <ProviderType value="System.Data.SqlClient" />
      <ConnectionString value="Data Source=localhost\sqlexpress;Initial Catalog=RecorderDB;Integrated Security=True" />
      <ThreadQueueLimit value="10000" />
      </Database>
      </Metadata>
  9. Save changes

  10. Restart  services WDServer, DVRServer and SMServer

Example configuration of Database.xml

XML
<?xml version="1.0"?>
<Database>
<Enabled value="True" />
<MaximumAlarmEventRows value="100000" />
<MaximumAlarmEventDays value="2147483647" />
<MaximumAuditTrailRows value="2147483647" />
<MaximumAuditTrailDays value="2147483647" />
<MaximumWatchdogEventRows value="100000" />
<MaximumWatchdogEventDays value="2147483647" />
<ProviderType value="System.Data.SqlClient" />
<DvmsDatabaseName value="DvmsData" />
<!-- <ConnectionString value="Data Source=172.17.102.145;Initial Catalog=DvmsData;User Id=sa;Password=test;Integrated Security=False" /> -->
<ConnectionString value="Data Source=172.17.102.145;Initial Catalog=DvmsData;User Id=sa;Password=Mirasys2022!;Integrated Security=False" />
<ParameterMarker value="@" />
<Tables>
<AlarmConfig value="AlarmConfig" />
<AlarmAction value="AlarmAction" />
<AlarmEvent value="AlarmEvent" />
<AuditTrail value="AuditTrail" />
</Tables>
<WdDatabase>
<ConnectionString value="Data Source=172.17.102.145;Initial Catalog=WdContext;User Id=sa;Password=Mirasys2022!;Integrated Security=False" />
</WdDatabase>
<DvmReportDatabase>
<ConnectionString value="Data Source=172.17.102.145;Initial Catalog=DvmReportContext;User Id=sa;Password=Mirasys2022!;Integrated Security=False" />
</DvmReportDatabase>
<FailoverDatabase>
<ConnectionString value="Data Source=172.17.102.145;Initial Catalog=Failover;User Id=sa;Password=Mirasys2022!;Integrated Security=False" />
<MaximumFailoverLogEntryRows value="5000" />
</FailoverDatabase>
</Database>

Example configuration of SMServer.exe.config

XML
<connectionStrings>
<!-- <add name="DvmsDataContext" connectionString="Data Source=192.168.1.100\INSTANCE,1435;Initial Catalog=DvmsData;User Id=sa;Password=test;Integrated Security=True/False;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" /> -->
<add name="DvmsDataContext" connectionString="Data Source=localhost\SQLEXPRESS;Initial Catalog=DvmsData;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
<add name="WdContext" connectionString="Data Source=localhost\SQLEXPRESS;Initial Catalog=WdContext;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
</connectionStrings>

Example configuration of dvr.xml

XML
<Metadata>
<Database>
<Enabled value="False" />
<ParameterMarker value="@" />
<CreateTablesCommand value="USE RecorderDB CREATE TABLE RecorderMetadata (Id int NOT NULL IDENTITY(1,1) PRIMARY KEY, SourceType int NOT NULL, EventTime bigint NOT NULL, FormatType int NOT NULL, Channel int NOT NULL, MetaData varchar(MAX) NULL ) CREATE NONCLUSTERED INDEX IX_RecorderMetadata ON RecorderMetadata ([Channel] ASC, [SourceType] ASC, [FormatType] ASC, [EventTime] ASC)" />
<CreateDatabaseCommand value="CREATE DATABASE RecorderDB" />
<ProviderType value="System.Data.SqlClient" />
<ConnectionString value="Data Source=localhost\sqlexpress;Initial Catalog=RecorderDB;Integrated Security=True" />
<ThreadQueueLimit value="10000" />
</Database>
</Metadata>
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.