How to set "Host" connection property?

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Guest

How to set "Host" connection property?

Post by Guest » Sat 07 May 2005 16:40

Hi, How do I set the "Host" property of a MS SQL Connection? (this value is visible in enterprise manager process list or using

select host_name()

statement)

In BDE I've set this using "HOST NAME" parameter, in SDAC I tried to use the MSConnection.Options.WorkstationID property, but without any effect on Host Name...
Thx!

Ludek

Post by Ludek » Tue 10 May 2005 15:23

sorry, i've forgotten: using SDAC version 3.50.0.12

Ludek

Post by Ludek » Tue 10 May 2005 15:23

sorry, i've forgotten: using SDAC version 3.50.0.12

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Wed 11 May 2005 06:14

You use MSConnection.Options.WorkstationID property correctly.
Please specify other MSConnection property values.

Ludek

Post by Ludek » Wed 11 May 2005 10:26

Following code demonstrates it:
it does not write 'testtesttest', but name of my computer.

program sdachostname;

{$APPTYPE CONSOLE}

uses
SysUtils, MSAccess, ActiveX;

var
c: TMSConnection;
q: TMSQuery;
begin
CoInitialize(nil);
c := TMSConnection.Create(nil);
try
c.Server := 'sqlserver';
c.Database := 'master';
c.Username := 'sa';
c.Password := '';
c.Options.WorkstationID := 'testtesttest';
c.Open;
try
q := TMSQuery.Create(nil);
try
q.Connection := c;
q.SQL.Text := 'select host_name() as hostname';
q.Open;
try
writeln(q.fieldByName('hostname').asString);
finally
q.Close;
end;
finally
q.Free;
end;
finally
c.Close;
end;
finally
c.Free;
end;
readln;
end.

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Wed 11 May 2005 14:24

Thank you for your sample. It does help us very much.
We reproduced your problem and fixed it. This fix will be included in the next SDAC build. It will be available in about three weeks.

Post Reply