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
- SQL Server Name
- SQL Server Credentials
- Access to the SQL Server
- Basic Understanding of SQL
- From the desktop of the client computer, create a new text document
- Change the .txt extension to .udl, if done correctly, the icon will change
- Open the UDL file and confirm the OLE DB Provider is "Microsoft OLE DB Provider for SQL Server"
- Go to the Connection tab
- For step 1, click the dropdown to see if you can find the SQL Server otherwise type in the full SQL Server name
- For step 2, select Use a specific user name and password and fill in the SQL User name and SQL Password fields
- For step 3, click the dropdown and see if a list of databases appear
- 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.
- If a Window appears saying "Login failed for user 'XXX'.", check your User name and Password and try again
- If a Window appears saying "...SQL Server does not exist or access denied, continue reading below
Check the SQL Server Name
- 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
- Check with your DBA or IT admin if you need a fully qualified name as this is common with enterprise IT and offsite servers
- If the SQL Server name is different, perform the UDL test
Check if the SQL Server Service is running
- On the SQL Server, check Services and make sure "SQL Server (MSSQLSERVER)" (replace MSSQLSERVER with your named instance) is running
- If it was already started, continue to the next section
- If it is not started, start it
- If you cannot start it, contact your database administrator (DBA) or a more experienced SQL Server user.
- If you can start it, perform the UDL test
Check Connection to the SQL Server on the Server
- Perform the UDL test on the SQL Server
- If a list of databases appear, continue reading below
- 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
- On the SQL Server, check if TCP port 1433 is allowed for inbound connections in your firewall
- If it is not listed as an exception, try adding one for TCP Port 1433 to your firewall, then perform the UDL test
- If it is listed as an exception, continue reading below
Check TCP/IP Settings
- On the SQL Server, open "SQL Server 20## Configuration Manager"
- Once in the SQL Server Configuration Manager, go to SQL Server Network Configuration > Protocols for MSSQLSERVER (replace MSSQLSERVER with your named instance)
- In the "Protocol Name" column, confirm "TCP/IP" is set to "Enabled", enable it if not
- Double click TCP/IP and go to the IP Addresses tab
- Scroll to the bottom and confirm under "IPALL", "TCP Port" is set to "1433", set this if not
- Click OK when done
- If prompted, restart the SQL Server instance (the service, not the server itself)
- Now perform the UDL test
Check SQL Server Browser
- On the SQL Server, go to Services and check if SQL Server Browser is running
- If "Startup Type" is "Automatic", but the service is not running, start it
- If "Startup Type" is "Disabled", go to its Properties and change the "Startup Type" to "Automatic", then start it
- Now perform the UDL test or test from your application
Add a SQL Server Browser Firewall Exception
- Add an exception for SQL Server Browser in your firewall
- Now perform the UDL test or test from your application
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 ...