Can the Application Name passed to SQL Server (via the ADO Connection string) be changed once the connection is open without closing and re-opening the connection?
In particular, I'm using ADO, not ADO.NET, and the SQLOLEDB.1 OLE DB Provider.
We embed the session information in the Application Name, to help us identify the connection specific to a user's session. This primarily helps when troubleshooting bad queries or performance issues.
We currently do not use a connection pool for our ADO connections. I'm considering implementing a connection pool, but would like to update the Application Name when a connection is removed from the pool, so that we have accurate session information in the Application Name.
I suggest to use SQL CONTEXT_INFO, 128 bytes available per connection, which can be changed at runtime: http://msdn.microsoft.com/en-us/library/ms189252%28v=sql.105%29.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With