Link Search Menu Expand Document

SqlBak-CLI documentation

Source Section

The settings for SQL Server connection are specified in the source field of the backup job specification, or in the target field if type is specified as mssql.

{
	"type": "mssql",
	"data_source": <String>,
	"is_integrated_security": <true\false>,
	"user_name": <String>,
	"user_password": <String>,
	"trust_server_certificate": <true\false>
	"backup_folder": <String>,
	"databases": [ <string array> ], 
	"database_types": [ "mssql_custom", "mssql_system" ]
}

Mandatory fields

data_sources

SQL Server address. Note, in order to have access to the created SQL Server backups, the application must be installed on the same server where SQL Server is installed. Therefore, only the local instance name can be used in this field.

is_integrated_security

Specifies whether to use Windows Authentication to connect to SQL Server. Only for Windows.

user_name

The SQL Server login.

user_password

Login password. Use the encrypt command to keep the password encrypted.

trust_server_certificate

Whether to trust the server’s certificate.

ALLOWED VALUES:

true – no certificate verification will be performed during an SQL Server connection

false – during SQL Server connection, the server’s certificate will be verified

databases or database_types

Please note, databases and database_types are mutually exclusive parameters, and you can specify only one of them.

In this field, the databases that should be backed up should be specified.

This field can be filled in two ways:

databases

Specify a list of databases separated by commas:

...
"databases": { "Database1","Database2","Database.." ]
}
...

database_types

Specify a type in database_types.

If you specify mssql_custom in databases_types, all non-system databases will be backed up:

...
"databases_types": [ "mssql_custom" ]
...

Alternatively, if you specify mssql_system in databases_types, all system databases will be backed up:

...
"databases_types": [ "mssql_system" ]
...

It’s also possible to specify both mssql_system and mssql_custom in databases_types at the same time. In this case, all system and non-system databases will be backed up

Examples

Settings for a local SQL Server connection to backup two databases: DataOne and MediaOne:

...

"source": {
	"type": "mssql",
	"data_source": ".",
	"is_integrated_security": false,
	"trust_server_certificate" : true,
	"user_name": "sa",
	"user_password": "secret-password",
	"databases": ["DataOne", "MediaOne"]
}

...