question

jghimirey avatar image
jghimirey asked

How can i find connecting string to SQL db from database?

How can i find connecting string to SQL db from database?
connection-string
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

sp_lock avatar image sp_lock commented ·
Normally the connection string is defining the connection to the database and not actually in the DB.. Unless it defines connection to another DB. Usually it is stored within a config file, e.g. in IIS it could be WEB.Config. Try the link below... http://www.connectionstrings.com/
3 Likes 3 ·
Kevin Feasel avatar image
Kevin Feasel answered
I'm thinking the question is along the lines of, "I have somebody who connected to a database on a SQL Server. How do I determine, from within SQL Server, the connection string that person used to connect to the server?" Unfortunately, the answer is, "You don't." You **can** get information about the connection from sys.dm_exec_connections and sys.dm_exec_sessions. Start with the following query: select * from sys.dm_exec_connections c inner join sys.dm_exec_sessions s on c.session_id = s.session_id; From there, you can determine things like protocol, authentication method (SQL or Windows), connecting hostname, application name, client interface, login, NT domain (if Windows authenticated), etc. This won't rebuild a connection string for you, but you can make some pretty decent guesses with this data.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jghimirey avatar image
jghimirey answered
Thanks Kevin!
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.