HostName in SP_WHO

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for SQL Server in Delphi and C++Builder
Post Reply
angelosobreira
Posts: 2
Joined: Wed 12 Aug 2015 17:34

HostName in SP_WHO

Post by angelosobreira » Wed 12 Aug 2015 18:19

Hello,
In BDE Administrator, when de users autenticate in system, I set a property in the settings of connection named "HOST NAME", and in SQL Server I execute de command sp_who, the column hostname has the information that I put in connection. In my case, I put the name of the user to know if there are more them one connection with the same name.

How can I do it with Devart DBXpress Driver for SQL Server?

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: HostName in SP_WHO

Post by azyk » Fri 14 Aug 2015 14:22

By default, dbExpress uses the WorkstationID connection parameter to pass the name of the local machine. You can override this value in our driver using the extended driver option 'Custom String'. For example, if you need to specify the name of a local machine as your_host_name, then add the following code before establishing connection:

Code: Select all

  SQLConnection.Params.Add('Custom String=WorkstationID=your_host_name);
See more details about the 'Custom String' driver extended option in the Readme.html file, that is in the folder with installed dbExpress driver for SQL Server.

Post Reply