How to Check SQL Server Connectivity from SharePoint?

How do I quickly check SQL Server connectivity from the SharePoint server? Well, you can use Telnet.
telnet {SQL-Server-Name or IP} 1433

If your SQL Server listens on a different port, change the default port 1433 accordingly.

Using PowerShell to test SQL server connectivity:
You can also use PowerShell to check if SharePoint is able to connect with SQL Server:

(New-Object System.Net.Sockets.TCPClient("SQL-Server-Name",1433)).Connected 
Check SQL Server Connectivity from SharePoint

This tells you whether the particular PORT is open on the given server.

Check SQL Server Connectivity by establishing a connection:

Run this PowerShell script to test whether you are able to connect with SQL Server.

Function Check-SQLServerConnection([string]$serverInstance)
    $connectionString = "Data Source={0};Integrated Security=true;Application Name=CheckSQLServer" -f $serverInstance;
    $sqlConn = new-object("Data.SqlClient.SQLConnection") $connectionString;

    Write-Host $connectionString

    try {
        Write-Host "Connected OK"-foregroundcolor white -backgroundcolor green
    catch { 
        Write-Host $_ -foregroundcolor white -backgroundcolor red
    finally { 
 #Call the function with your SQL Server Machine Name
 Check-SQLServerConnection "SP13-SQL01" 

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. Passionate about sharing the deep technical knowledge and experience to help others, through the real-world articles!

Leave a Reply

Your email address will not be published. Required fields are marked *