Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...


Code Block
ComputerName           : srv-2
RemoteAddress          : 10.0.18.96
RemotePort             : 1433
InterfaceAlias         : Ethernet
SourceAddress          : 10.0.18.54
PingSucceeded          : True
PingReplyDetails (RTT) : 1 ms
TcpTestSucceeded       : False

 

If "PingSucceeded" or "TcpTestSucceeded" is false, then probably the firewall hasn't been opened.
To have more detailsFor a better error message, run the following script in PowerShell and fill in the information as requested:


Code Block
languagepowershell
titleODBC Connection Diagnostic
$servername = Read-Host -Prompt "Enter SQL Server and instance name"
$database = Read-Host -Prompt "Enter database name"

$installtype = Read-Host -Prompt "Enter 'f' if you are testing the database connection for the frontend or 'b' for the backend"

$Error.Clear()
$connection = New-Object System.Data.Odbc.OdbcConnection

switch ($installtype.ToLower()) {
    'f' {
        $login = Get-Credential
        $connection.ConnectionString = "Driver={ODBC Driver 17 for SQL Server};Server=$servername; Uid=$($login.UserName);Pwd=$($login.GetNetworkCredential().Password); Database=$database"
    }
    'b' {
        $connection.ConnectionString = "Driver={ODBC Driver 17 for SQL Server};Server=$servername; Trusted_Connection=yes; Database=$database"
    }
    Default { Write-Error -Message "Invalid choice. Exiting." -ErrorAction Stop }
}

Write-Host "Connecting..."

$connection.Open()
$connection.Close()

if ($Error.Count -eq 0) {
    Write-Host "Connected"
}
 



Multiple Instances, Dynamic Ports and Special Configurations

Please note that if you are running more than one instance of SQL Server on the same machine, or you are using named instances, dynamic ports will be used. If only one instance is present on the server, it usually can be contacted through port 1433. 

...