Extended Events - Capture connection string used to connect to SQL

Mark Gordon 901 Reputation points
2020-09-21T17:24:10.133+00:00

Fellow SQLers,

I am trying to see if I can capture the actual connection string used when a user connects to SQL.

I know I can capture their options (Set ….. etc) but cannot find an event that give me the actual connection string.

Is it doable with Ext Events?

Thx

MG

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,707 questions
0 comments No comments
{count} votes

Accepted answer
  1. Tom Phillips 17,716 Reputation points
    2020-09-21T18:28:37.2+00:00

    That data does not exist in SQL Server. The connection string is how the caller connects to SQL Server.

    What exactly are you looking for?

    1 person found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Erland Sommarskog 101K Reputation points MVP
    2020-09-21T21:36:58.027+00:00

    As Tom says, this is not possible. The connection server is the client's business, and not SQL Servers. You can deduce some of the contents down in SQL Server, for instance by looking at functions such APP_NAME() or HOST_NAME(). But things like passwords, connection timeout, or configuration of the connection pool never makes it to SQL Server.

    1 person found this answer helpful.
    0 comments No comments

  2. Mark Gordon 901 Reputation points
    2020-09-22T16:16:52.04+00:00

    Thanks Guys.
    I can take it from here.
    mg

    0 comments No comments