I have an application that simply opens an SqlConnection to a remote host. My code is something like this:
SqlConnection sc = new SqlConnection();
sc.ConnectionString = sConnectionString;
sc.Open();
I ran the application while my network monitoring tool is open. I noticed that there were 4 local ports opened that communicates with the 1433 port of the remote host. I am expecting that only 1 port will open. Why is this so?
If you have permissions to see the open database connections in the remote database server, compare this to the tcp/ip connections open in the machine hosting the application.
If the number of connections open on the database server match with the corresponding tcp/ip connections, you can be sure that there are multiple simultaneous connections open, and debug this further.
In SQL Server 2008, execute sp_who2
or open the Activity Monitor. You should be able to identify the connection sources from the results. In the application host use netstat -n
or other network monitoring tool.