Application Name in MSSQL
Steven Burrows
Am trying to identify which of my Magic Applications is connected to my MSSQL Database, but the program_name in sys.sysprocesses is always “Magic xpa” Have tried “Application Name = MyApp” in the Database Connection String property (was blank), but it doesn’t have any effect.
XPA 4.8 via OLEDB
Steven Burrows
|
|
Hi,
i think you can't use database connection string in magic for this purpose ,only for user name ,password and server.
One of solutions is to use built in sql server utility slqcmd invoke cmd in magic something like
sqlcmd -S server name -H you application name
Flag -H can be used to set "workstation_name". It's is not the application name, but can serve the same purpose. Use SELECT HOST_NAME() to get the value.
to check you can run from cmd sqlcmd -S servername -H test
select HOST_NAME()
GO
you need to receive testsecond way is to create connection to database via .net from magic and send this connection string with you credentials
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=database name;Data Source=server name;Application Name=test
I checked this connection with .udl utility and received in profiler application name test as my connection string. And after connection you can receive value from select APP_NAME() or sysprocesses |
|
Todd Baremore
Steven,
toggle quoted message
Show quoted text
It may be easier to maintain your own two column table using @@SPID and your application name. You could link to sys.dm_exec_sessions for the rest. Todd On 1/6/2023 4:39 AM, Steven Burrows
wrote:
|
|