July 15, 2014 at 3:07 am
Hi guys,
Is there any SQL script that I can use to know what application connected to each databases?
Thanks!
July 15, 2014 at 3:11 am
Only if the applications set that property in the connection strings when they connect to SQL. If they do, you can query the Program_Name column in sys.dm_exec_sessions.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
July 15, 2014 at 3:11 am
You will need to ensure that your connection strings have the application name parameter set in them to do it, then you can check the sys.dm_exec_sessions DMV to get out the connections and the program name connecting to your server.
https://www.connectionstrings.com/use-application-name-sql-server/
July 17, 2014 at 10:01 pm
Thanks guys! 😀
July 18, 2014 at 8:41 am
anthony.green (7/15/2014)
You will need to ensure that your connection strings have the application name parameter set in them to do it
And note that copy/paste coding leads to Application D using Application A's name. Consider tracking not only the application name it sends you, but also the login name and host name and/or client IP address - sometimes it's a tipoff when "Application A" is coming from a host it's not [supposed to be] installed on, or with an unusual login name.
July 18, 2014 at 8:44 am
Nadrek (7/18/2014)
anthony.green (7/15/2014)
You will need to ensure that your connection strings have the application name parameter set in them to do itAnd note that copy/paste coding leads to Application D using Application A's name. Consider tracking not only the application name it sends you, but also the login name and host name and/or client IP address - sometimes it's a tipoff when "Application A" is coming from a host it's not [supposed to be] installed on, or with an unusual login name.
+10
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply