Skip to content

Automatically Save a Database

The task scheduler can be used to execute batch files in specified time intervals. The easiest way is to create a batch file, which saves the database and execute it in the task scheduler.

Batch File to Save the Current Database

To save the current databases automatically, a batch file needs to be created (e.g. Taurec_Save_Database.bat). The batch file should start the Console.exe application with parameters.

Example of a batch file:

@echo off
start '' /wait C:\MyServer\Console.exe ^
  Batch=True ^
  User=Local_SaveDatabase ^
  Password=sG7t&z$3i2#18b1^
  Database=Finance ^
  Host=127.0.0.1 ^
  Port=8700 ^
  TLS=True ^
  Timeout=300 ^
  File=C:\MyServer\Batch\SaveDatabase.txt ^
  IgnoreErrors=False

Console Parameters

First Parameter

Path to the console application (e.g. C:\MyServer\Console.exe).

Batch

Must be True for batch files.

User

Name of the user. It is recommended to use a Local user. A Local user must be created manually and the name must start with Local. E.g. Local_Import or Local_Save. In the database and the user kind must be Admin to save databases. A Local user can only connect directly on the server (localhost) and not from the network. So it is secure to write the password in the bash file.

Password

Password of the user.

Database

Name of the database to be saved.

Host

Name or IP address of the server.

Port

Port of the server. The default port is 8700.

TLS

If the server uses TLS (Transport Layer Security) this parameter must be True.

Timeout

Timeout in seconds. The default timeout is 300 seconds.

File

Path to the command file (e.g. C:\Command\Save_Database.txt). The command file is a text file which contains one or more API commands in text format. In this example the SAVE DATABASE API command is used to saves the current database. SAVE DATABASES saves all running databases, regardless of which database you are logged on.

Example of a command file to save a database (e.g. Save_Database.txt):

SAVE DATABASE

IgnoreErrors

If a file contains several commands and one command returns an error, the execution is stopped. If IgnoreErrors=True the following commands will still be executed. The default value is False.