Setting the application name - Ease to monitor the application performance

Sometimes, we used to monitor the performance of our application. In that case, I have seen the application name is generic. For instance, If we use 2 dotnet application to access the database both were showing the application name as ".Net SQLClient Data provider". Oops, Is there any way to segregate this?

Yes, its possible. We can specify the application name in the connection string. You profiler or activity monitor will provide you the application name as the name specified in your connection string.

Generic connection string (Windows authentication):

Data Source=ServerName; Initial Catalog=DatabaseName; Integrated Security=SSPI; Application Name=MyAppName;

Generic connection string (Windows authentication):

Data Source=ServerName; Initial Catalog=DatabaseName;
Persist Security Info=True;User ID=venkat;Password=venkat;Application Name=MyAppName;


Cheers,
Venkatesan Prabu .J
http://venkattechnicalblog.blogspot.com/