source

source

This command is used to manage database connection settings on the backup agent. To perform database backups, SqlBak needs to know how to connect to the databases. Connection details are stored only on the backup agent and are never sent to the SqlBak server.

add

Adds a new database connection.

Syntax:

sqlbak source add --source-type=DBMS-TYPE --load-from-file=path/to/file.json

Parameters:

  • --source-type (required) – The type of database for the connection. Supported values:
    • mssql – Microsoft SQL Server
    • mysql – MySQL or MariaDB
    • postgresql – PostgreSQL
  • --load-from-file (required) – Path to a JSON file containing the connection settings. To generate a template JSON file, use:Edit the file to include the correct connection details and use it with the add command.
sqlbak source get-default --source-type=DBMS-TYPE --save-to-file=/path/to/file.json

Note: Connections are not tested automatically when added. It is recommended to test them using the test-connection command.

list

Displays a list of configured connections.

Syntax:

sqlbak source list [--output-format=output-type]

Parameters:

  • --output-format (optional) – Specifies the output format. Available values:
    • table – Display in a readable table format (default)
    • JSON – Display in raw JSON format

Note: This command is useful to retrieve the source-id, which is required for other operations (see the Id column in the output).

get-default

Creates a template JSON file for use with the add command.

Syntax:

sqlbak source get-default --source-type=DBMS-TYPE --save-to-file=path/to/file.json [--ssh-tunnel]

Parameters:

  • --source-type (required) – Type of database. Supported values:
    • mssql – Microsoft SQL Server
    • mysql – MySQL or MariaDB
    • postgresql – PostgreSQL
  • --save-to-file (required) – Path to save the generated JSON template
  • --ssh-tunnel (optional) – Adds an SSH tunnel configuration section to the output file

test-connection

Tests a Backup Source connection.

Test an existing source

sqlbak source test-connection --source-id=<source_id>

Parameters:

  • --source-id – ID of the saved source connection to test.

Test source settings from a file

You can also validate new source settings loaded from a file before saving the source.

sqlbak source get-default --source-type=mysql --save-to-file=/tmp/mysql-source.json --confirm

Edit /tmp/mysql-source.json and fill in the connection details. Then test the settings:

sqlbak source test-connection --source-type=mysql --load-from-file=/tmp/mysql-source.json

If the test succeeds, add the source:

sqlbak source add --source-type=mysql --load-from-file=/tmp/mysql-source.json

Parameters:

  • --source-type – Source type: mssql, mysql, postgresql, or folder.
  • --load-from-file – Path to a file with source connection settings.

update

Updates an existing connection with new settings.

Syntax:

sqlbak source update --source-id=connectionid --load-from-file=path/to/file.json

Parameters:

  • --source-id (required) – Connection identifier, can be obtained using the list command
  • --load-from-file (required) – Path to the connection settings file. The file must be in JSON format. To generate a template file, use:
sqlbak source get-default --source-type=DBMS-TYPE --save-to-file=/path/to/file.json

delete

Deletes a configured database connection.

Syntax:

sqlbak source delete --source-id=connectionid

Parameters:

  • --source-id (required) – Connection identifier, can be obtained using the list command