Easiest way to test SQL Server connection

The other day I found an interesting way to test SQL Server database connection. It is very easy and quicker than what I usually do. For those of you who like moving pictures, here is a video tutorial.

To test database connection, what I usually do is to make sure port is open by using Telnet command and then use a tool like SQL Command Line, or SQL Server Management Studio,  Visual Studio Server Explorer, etc. If none of these tools is available, we can still use ODBC Data Source tool to test.  However, there is another way, a shortcut approach.

Create a new .txt file, change the file extension from .txt to .UDL, and then open the Properties of the file. In the Connection tab, you can test database from there!

7-1-2014 10-39-33 AM

Also in the Provider tab, you can select any provider for the test.

7-1-2014 11-08-30 AM

If you save the database connection in the Properties window, you can find the connection string by opening the UDL file with Notepad.

One shortage of this approach is that it seems unable to test SQL Server high availability group connection. There is not a parameter for configuring MultiSubnetFailover. I tested with an AG listener with database nodes from different subnets and it couldn’t connect.

However, it doesn’t change the fact that this is the easiest way to test SQL Server connection. Hope you find this trick useful!

Post JSON to REST web service with soapUI

Among several web service test tools I have used, including WCFStorm, VS WCF Test Client, and other proprietary test tools, soapUI is my favorite. In a recent project, with the help of soapUI, I was able to add custom fields into HTTP header, compose the authentication header field, and POST JSON data to a REST web service. This post aims to provide a quick guide on how to add REST web services to soapUI and post JSON to the services.

Create a new project.

9-17-2013 11-00-15 AM

Provide a name and select the option Opens dialog to create REST service. Click OK.

9-17-2013 11-01-25 AM

In the next screen, provide the web service’s URL and select the option Extract Resource and Method from specified Endpoint, so that SoapUI can analyze the URL and find out the parameters in it. In my example, Site ID and User ID. Click OK.

9-17-2013 11-03-17 AM

You can define the parameter names and default values on the next screen. Click OK.

9-17-2013 11-07-07 AM

Next you can setup your method, including HTTP method and parameters. We will select POST here to demonstrate how to post JSON.

Click OK to finish creating the method.

9-17-2013 11-08-49 AM

Now we can go ahead to expend our project and method, and select the request just created. On the right pane, our parameters and end point are displayed.

9-17-2013 11-10-19 AM

Next, modify the Media Type to using application/json. There is no such an option in the dropdown list so it has to be typed.

Then type up the JSON you want to post.

Click on the green arrow on the left upper corner of the request. soapUI will post the data to the endpoint.

9-17-2013 11-16-16 AM

Click on the Raw tab to view the raw data just posted!

9-17-2013 11-19-27 AM

As it is demonstrated, soapUI is a very flexible and effective tool which offers a free, quick, and simple solution to test web services.