Merge pull request #124 from Icinga:fix/mssql_open_connection_empty_db

Fixes MSSQL connection string on empty DB
This commit is contained in:
Lord Hepipud 2020-08-28 14:07:11 +02:00 committed by GitHub
commit b39af24b14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -68,7 +68,7 @@ function Open-IcingaMSSQLConnection()
$SqlConnection = New-Object System.Data.SqlClient.SqlConnection;
$SqlConnection.ConnectionString = "Server=$Address,$Port;";
if ($null -ne $SqlDatabase) {
if ([string]::IsNullOrEmpty($SqlDatabase) -eq $FALSE) {
$SqlConnection.ConnectionString += "Database=$SqlDatabase;";
}