Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/100-General/10-Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic

[Issues and PRs](https://github.com/Icinga/icinga-powershell-framework/milestone/44)

### Enhancements

* [#865](https://github.com/Icinga/icinga-powershell-framework/pull/865) Adds support for MSSQL shared memory feature, by not using a port for the connection string by using 0 or lower as port number

### Bugfixes

* [#877](https://github.com/Icinga/icinga-powershell-framework/pull/877) Fixes threshold comparison while using `%`-Values, which caused falsely report of `Warning` threshold being larger than `Critical` threshold
Expand Down
8 changes: 7 additions & 1 deletion lib/mssql/Open-IcingaMSSQLConnection.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@ function Open-IcingaMSSQLConnection()

try {
$SqlConnection = New-Object System.Data.SqlClient.SqlConnection;
$SqlConnection.ConnectionString = "Server=$Address,$Port;";

# Only add the port if it is above 0. Otherwise the fall back to the Shared Memory feature of MSSQL
if ($Port -le 0) {
$SqlConnection.ConnectionString = "Server=$Address;";
} else {
$SqlConnection.ConnectionString = "Server=$Address,$Port;";
}

if ([string]::IsNullOrEmpty($SqlDatabase) -eq $FALSE) {
$SqlConnection.ConnectionString += "Database=$SqlDatabase;";
Expand Down