Troubleshooting a SQL Server Connection

Troubleshooting a SQL Server Connection

Overview

If you are unable to connect to a SQL database, you can perform what's called a UDL test which uses a built-in SQL Server OLE DB provider to test SQL connections. This is done independent of any software application and is a great troubleshooting step. The following article will show you how to perform a UDL test as well as several troubleshooting steps. 

Requirements

  1. SQL Server Name
  2. SQL Server Credentials
  3. Access to the SQL Server
  4. Basic Understanding of SQL 

Perform UDL Test

  1. From the desktop of the client computer, create a new text document
  2. Change the .txt extension to .udl, if done correctly, the icon will change
  3. If you don't see the extension, read How to Show Extensions
  4. Open the UDL file and confirm the OLE DB Provider is "Microsoft OLE DB Provider for SQL Server"
  5. Go to the Connection tab
  6. For step 1, click the dropdown to see if you can find the SQL Server otherwise type in the full SQL Server name
  7. For step 2, select Use a specific user name and password and fill in the SQL User name and SQL Password fields
  8. For step 3, click the dropdown and see if a list of databases appear
    1. If databases appear, your connection to the SQL Server instance is good, however, if you still cannot connect from your application, go to the "Check SQL Server Browser" section.
    2. If a Window appears saying "Login failed for user 'XXX'.", check your User name and Password and try again

    3. If a Window appears saying "...SQL Server does not exist or access denied, continue reading below

Check the SQL Server Name

  1. SFA uses the default instance when creating our SQL Server instances, but it's not uncommon to use a named instance such as SERVERNAME\SQLEXPRESS or SERVERNAME\SOFTWARE
  2. Check with your DBA or IT admin if you need a fully qualified name as this is common with enterprise IT and offsite servers
  3. If the SQL Server name is different, perform the UDL test

Check if the SQL Server Service is running

  1. On the SQL Server, check Services and make sure "SQL Server (MSSQLSERVER)" (replace MSSQLSERVER with your named instance) is running
    1. If it was already started, continue to the next section
    2. If it is not started, start it
      1. If you cannot start it, contact your database administrator (DBA) or a more experienced SQL Server user.
      2. If you can start it, perform the UDL test

Check Connection to the SQL Server on the Server

  1. Perform the UDL test on the SQL Server
    1. If a list of databases appear, continue reading below
    2. If a list of databases does not appear, confirm either the SQL Server name, i.e. instance, is good and that the SQL Server is actually running

Check for SQL Server Firewall Exception

  1. On the SQL Server, check if TCP port 1433 is allowed for inbound connections in your firewall
    1. If it is not listed as an exception, try adding one for TCP Port 1433 to your firewall, then perform the UDL test
    2. If it is listed as an exception, continue reading below

Check TCP/IP Settings

  1. On the SQL Server, open "SQL Server 20## Configuration Manager"
  2. Once in the SQL Server Configuration Manager, go to SQL Server Network Configuration > Protocols for MSSQLSERVER (replace MSSQLSERVER with your named instance)
  3. In the "Protocol Name" column, confirm "TCP/IP" is set to "Enabled", enable it if not

  4. Double click TCP/IP and go to the IP Addresses tab
  5. Scroll to the bottom and confirm under "IPALL", "TCP Port" is set to "1433", set this if not
  6. Click OK when done

  7. If prompted, restart the SQL Server instance (the service, not the server itself)
  8. Now perform the UDL test

Check SQL Server Browser

  1. On the SQL Server, go to Services and check if SQL Server Browser is running
    1. If "Startup Type" is "Automatic", but the service is not running, start it
    2. If "Startup Type" is "Disabled", go to its Properties and change the "Startup Type" to "Automatic", then start it
    3. Now perform the UDL test or test from your application

Add a SQL Server Browser Firewall Exception

  1. Add an exception for SQL Server Browser in your firewall
  2. Now perform the UDL test or test from your application
  3. You can find your exact path for the application, but the most common is "C:\Program Files (x86)\Microsoft SQL Server\90\Shared\sqlbrowser.exe" 

End of the Line

If you made it this far and still unable to connect to the SQL Server, it is best to reach out to a DBA or a more experienced SQL Server user.



    • Related Articles

    • Firewall Exceptions for SQL Server

      Overview SQL Server uses both TCP and UDP ports for communication. It is necessary to allow these ports through the firewall. TCP Incoming Ports 1433 4022 135 1434 UDP Incoming Ports 1434
    • How to Use NETSTAT to Locate TCP Socket Connections

      Overview Locating an application that is using a TCP Socket is vital to troubleshooting a conflict. NETSTAT is a built in Windows tool. Requirements Local Administrator Rights Experience with Command Prompt Using NETSTAT Open an elevated Command ...
    • How to Enable .NET Framework 3.5

      Overview Windows 10 and 11 no longer comes with .NET 3.5 enabled by default. In addition, it may not allow you to install .NET 3.5 from an installer. You can enable it via Windows Features. To enable .NET Framework 3.5 on Windows Server OS, you must ...
    • Why are most Okuma MTConnect tags UNAVAILABLE

      Problem The MTConnect Agent on the Okuma control appears to be working, but most tags are UNAVAILABLE Reason Upon installation of the MTConnect Adapter, the Enable Monitoring Tags checkbox was not checked Solution Open the MTConnect Adapter, go to ...
    • How to Use Okuma SCOUT to Determine MTConnect Version & Compatibility

      Overview This guide will take you through the steps to see if your P series Okuma CNC is compatible with MTConnect Requirements Setup a free Okuma Account (found at www.myokuma.com) SCOUT app (found at www.myokuma.com) USB Flash Drive Optional: USB ...