SqlBak.Job.Cli.exe reference manual

The sqlbak.job.cli.exe utility is a programming interface for working with the SqlBak application. It is located in the root directory where the application is installed.

This tool can be used to register the application, manage connections to DBMS, and import jobs from JSON configurations.

Below you can find all the commands and parameters supported by the sqlbak.job.cli.exeutility.

Registration of the Application (-install)

Usage:

SqlBak.Job.Cli.exe -install [--parameter-name=parameter-value]

Purpose:

Establish a connection of the SqlBak app to sqlbak.com.

Required parameters:

--secret-key –  This value can be found on the Download page.

Optional parameters:

--server-name – The name under which the connected server will be displayed on the Dashboard page. By default the system name of the computer is used.

Use case:

SqlBak.Job.Cli.exe -install --secret-key=xxxxxxxx-xxxx-xxxx-xxx-xxxxxxxxxxxx --server-name=my-server

Add a connection to the DBMS (–save-connection)

Usage:

SqlBak.Job.Cli.exe --save-connection [--parameter-name=parameter-value]

Purpose:

Connect the SqlBak app to DBMS.

Required parameters:

--db-type – A type of database to be connected. Possible values:

  • sql-server – Microsoft Sql Server (local)
  • mysql – MySQL Server (TCP/IP)
  • postgresql – PostgreSQL Server (TCP/IP)
  • sql-server-azure  –  Azure SQL Server
  • sql-server-amazon – Amazon RDS SQL Server
  • sql-server-remote – Microsoft SQL Server (remote)
  • mysql-phpmyadmin – MySQL (phpMyAdmin)

--host – An address of a server to be connected. As a rule, the network address is used, for example: 127.0.0.1 or temp-sql-server.database.windows.net. For Microsoft SQL Server (local), you can simply specify a dot if the default SQL Server should be used.
--user– User name which will be used to connect to a database.
--password  – User password.

Optional parameters:

Different advanced parameters are available for different types of databases:

SQL Server (Local)
  • --integrated-security, -is – The value to indicate if the connection should use a Windows account (optional, default is Y, possible values: Y, N).
  • --domain, -d – User domain name (optional).
SQL Server (Remote)
  • --integrated-security, -is – Value to indicate if the connection should use a Windows account (optional, default is N, possible values: Y, N).
  • --domain, -d – User domain name (optional).
  • --timeout, -to – Connection timeout in seconds (optional, default is 180).
MySQL Server (TCP/IP)
  • --port, -P – Port number (default is 3306).
  • --use-ssh, -ssh – Value to indicate if the MySQL connection should be established with an SSH tunnel (default is N, possible values: Y, N).
    • --ssh-host, -sshh – SSH host name (required when –use-ssh is Y).
    • --ssh-port, -sshp – SSH port number (optional, default is 22).
    • --ssh-user, -sshu – SSH user name (required when –use-ssh is Y).
    • --ssh-password, -sshup – SSH user password (optional).
    • --ssh-local-mapped-port, -sshmp – Specifies the local mapped port for ssh tunnel (required when –use-ssh is Y).
  • --timeout, -to – Connection timeout in seconds (default is 30).
  • --mysql-path, -ms – Path to MySQL bin folder.
MySQL Server (phpMyAdmin)
  • --server, -s – MySQL instance name (optional).
PostgreSQL Server (TCP/IP)
  • --port, -P – Port number (optional, default is 5432).
  • --default-database, -ddb – Default database name (optional, default is postgres).
  • --ssl-mode, -sslm – SSL connection mode (optional, default is preferred, possible values: disable, prefer, require, allow, verify-ca, verify-full). Supported values: disable, prefer, require, allow, verify-ca, verify-full
  • --password-setter-type, -pst – Type of password setter (optional, default is an environment, possible values: environment (env), file).
  • --pgsql-path, -ps – Path to the PostgreSQL bin folder (optional).

Use case:

SqlBak.Job.Cli.exe --save-connection --db-type=sql-server-local --name=. --user=user --password=my-secret-pw --test=Y

List DBMS Connections ( –list-connections )

Usage:

SqlBak.Job.Cli.exe --list-connections

Purpose:

Lists all available connections.

Delete DBMS Connection ( –delete-connection )

Usage:

SqlBak.Job.Cli.exe --delete-connection --connection-id=[id-connection]

or

SqlBak.Job.Cli.exe --delete-connection --dbms-type=[db-type] --connection-name=[name of connection]

Purpose:

Removes the created database connection. This command can be used to delete a connection by ID or by database type and connection name.

Parameters:

  • --connection-id, -ci – Connection ID. The ID list can be viewed via --list-connections command.
    or
  • --dbms-type,-dt – Database type.
  • --connection-name, -cn – A connection name can be viewed with the --list-connectionscommand.

Use case:

SqlBak.Job.Cli.exe --delete-connection --connection-id=1

or

SqlBak.Job.Cli.exe -dc -dt sql-server-local -cn=.

Test DBMS Connection ( –test-connection )

Usage:

SqlBak.Job.Cli.exe --test-connection --connection-id=[id-connection]

or

SqlBak.Job.Cli.exe --test-connection --dbms-type=[db-type] --connection-name=[name of connection]

Purpose:

Tests the connectivity to the database server. You can specify the tested connection either directly via ID or via database and connection name.

Parameters:

  • --connection-id, -ci – Connection ID. The ID list can be viewed via --list-connections command.
    or
  • --dbms-type,-dt – Database type.
  • --connection-name, -cn – A connection name can be viewed with the --list-connectionscommand.

Use case:

SqlBak.Job.Cli.exe --test-connection --connection-id=1

or

SqlBak.Job.Cli.exe --test-connection --dbms-type=sql-server-local --connection-name=.

Backup job import (–import-job)

Usage:

SqlBak.Job.Cli.exe --import-job [--parameter-name=parameter-value]

Purpose:

Creates a job and imports settings from the specified file.

Required parameters:

  • --secret-key, -sc – This value can be found on the Download page.
  • --file, -fThe path to the JSON file with a job’s settings, JSON file can be downloaded by clicking the “Export to JSON” icon on a backup job‘s summary page.

Optional parameters:

  • --code-page, -cp  – File encoding is specified in the --file parameter. The default value is UTF-8
  • --timeout, -to The maximum time of command execution in seconds, after which, if a job is not created, an error will be generated. The default value is 120

Use case:

SqlBak.Job.Cli.exe --import-job --secret-key=xxxxxxxx-xxxx-xxxx-xxx-xxxxxxxxxxxx --file=C:\Users\Me\Downloads\job_23364.json

Update Server Settings ( –update-settings )

Usage:

SqlBak.Job.Cli.exe --update-settings [--parameter-name=parameter-value]

Purpose:

Updates global application settings for all jobs.

Parameters:

  • --server-name, -sn – The name under which the connected server will be displayed on the Dashboard page.
  • --temporary-folder, -tf – Path to a temporary folder.

Use case:

SqlBak.Job.Cli.exe --update-settings --server-name='my-private-server'

Leave a Comment