Identify Application Name

  • Hi guys,

    Is there any SQL script that I can use to know what application connected to each databases?

    Thanks!

  • 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

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • 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/

  • Thanks guys! 😀

  • 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.

  • 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 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.

    +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