SharePoint

Handy Tip for Testing SQL Connectivity

Handy Tip for Testing SQL ConnectivityI was recently trying to troubleshoot why my custom SharePoint application could not connect to a database, and I found this great tip on the ASP.Net forums that I wanted to share for when you can’t or don’t want to install SQL Management Studio onto the server.

First a little back story: My application is pulling some financial data from an SAP database to display to the users. The farm is set up with a SharePoint web front end server inside the firewall for internal employees to log in to, and another web front end is located in the DMZ which is what their customers log into using forms based authentication.

When developing an application, it is essential that you carry out software testing prior to your application going to launch. Automated software testing solutions can help developers and testers to efficiently scan, test, and analyze coding for potential security vulnerabilities. Consequently, security testing your application can help to identify any bugs or issues.

As for my own application, the client recently moved their SAP database to a different server so we thought, no problem, we’ll just update the connection string and all will be good.

Right…

Everything worked fine from the internal server, however from the DMZ server, I was getting the following error message (mind you it’s the exact same codebase, using the exact same connection string in the respective web.config files):

Login failed for user ‘[user name]’

The DBA was convinced that it was an issue with the code passing an empty security token to the database. In my attempt to prove him wrong, I wanted to check whether the DMZ server itself could even connect to the database in question.

Since this was a production web front end server, I couldn’t install SQL Management Studio on it to test the connectivity. That’s when I ran across this awesome tip:

  1. Create an empty text file in Windows Explorer and rename it to X.UDL
  2. Double click on it and the Data Link Properties dialog will appear.
  3. Select the Connection tab. Enter the server and credentials.
  4. Test the connection.

Following are my results from the interal server:

Handy Tip for Testing SQL Connectivity

And from the DMZ server:

Handy Tip for Testing SQL Connectivity

Which proves that the server itself could not connect to the database and that it wasn’t my application passing an invalid security token.

(Visited 521 time, 1 visit today)

About Me

Wendy Neal

Wendy Neal

I am a .NET SharePoint Developer for DMI. I've worked with SharePoint since 2007. I love to share my passion for SharePoint and Office 365 by speaking at various industry and user group events, as well as writing articles for various publications and this blog.   Read More

MCSA Office 365
Top 50 SharePoint Blogs

Buy My Book

Archives

  • 2018 (1)
  • 2017 (1)
  • 2016 (8)
  • 2015 (23)
  • 2014 (20)
  • 2013 (22)
  • 2012 (15)
  • 2011 (13)