Blog Post

.Net SQLConnectionStringBuilder ApplicationName Property

,

We have several “Home Grown” applications at my current place of employment.  This provides our development staff with a great deal of flexibility.  We are allowed to upgrade to new versions of software at our own schedule.  We have full control of the source code and can modify it to accommodate the needs of our end-users as needed.   Recently, I put in a small change request.  I am currently using a suite of data visualization components for SSRS and Visual Studio provided by Nevron. During my development of a small .Net application that will monitor % Processor Times on my SQL Servers  using a Gauge component I noticed a property of the SQLConnectionStringBuilder that could be very useful to a SQL Database Administrator.

Currently, when I look at the SQL Profiler for any of our .Net applications the Application name is listed as .Net SqlClient Data Provider.  This is because we do not set the ApplicationName Property on our connection string.  Therefore, if a particular application is suffering from performance problems, we (the DBA) sometimes will have to sift through very large trace files to identity the problems.  We do have other means of other identifying problems, but the Trace is a very helpful tool.  So here is the request…

My request was to have the Application Developers set the ApplicationName on their connection strings.  I am not sure how soon it will be implemented, however I am sure we will see benefit from the change.  The following is a small code snippet of how I set it.

 

image

 

As you can see from the above snippet I set the application name to Nevron SQL Dashboard.  As a result, I can filter my trace on that application and it only returns calls to the database from that application.  See the sample trace below:

 

image

 

As you can see in the ApplicationName column, only events specific to my filter are returned. 

Talk to you soon

Patrick LeBlanc, founder TSQLScripts.com and SQLLunch

SQL Down South

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating