Thursday, August 14, 2014

How to Check SQL Server Connectivity from SharePoint

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

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

Using PowerShell to test SQL server connectivity:
Or you can use PowerShell to check if SharePoint it able to connect with SQL Server:

(New-Object System.Net.Sockets.TCPClient("SQL-Server-Name",1433)).Connected 
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" 

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.

Check out these SharePoint products:

No comments :

Post a Comment

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...