How does Profiler Data – ApplicationName get set | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

How does Profiler Data – ApplicationName get set

I found out I could specify the ApplicationName as a parameter in the connection string an app makes to a DB. But If I don’t put it in there, where does it get populated from? Registry? Operating System Variable?. Here’s my issue: I want to use connection pooling, so I want my connection strings to be the same. But, in the connection string, I can set ApplicationName = a session variable from IIS (which will allow me to trace SQL activity related to a specific WEB session. But I don’t want this to interfere with my connection pooling. Can the ApplicationName be set so it is different for each connection, but not interfer with connection pooling?

As far as I know if you include the ApplicationName in the connection string and set it to the session var as you described then (presuming you’re using ado or each new session will create a different connection pool (until you reach a maximum I guess).
It’s not ideal as each user will have their own connection pool and that doesn’t give you any real benefit in a web app, especially if you’re dealing with alot of users.
You could build some sort of audit in by passing the user’s login or session id as a parameter to your stored procs and writing it off somewhere but as fas as using it in the connection string you’d have to forego any benefits from connection pooling. Cheers
Shaun World Domination Through Superior Software
This is an example for connection string with Application Name:<br /><br />Provider=SQLOLEDB.1;Integrated Security=SSPI<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ersist Security Info=False;User ID=sa;Initial Catalog=DBName;Data Source=SQLSrvName;Application Name=AppName<br /><br /><br />Oryan