Page 1 of 1

How to set "Host" connection property?

Posted: Sat 07 May 2005 16:40
by Guest
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!

Posted: Tue 10 May 2005 15:23
by Ludek
sorry, i've forgotten: using SDAC version 3.50.0.12

Posted: Tue 10 May 2005 15:23
by Ludek
sorry, i've forgotten: using SDAC version 3.50.0.12

Posted: Wed 11 May 2005 06:14
by Ikar
You use MSConnection.Options.WorkstationID property correctly.
Please specify other MSConnection property values.

Posted: Wed 11 May 2005 10:26
by Ludek
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.

Posted: Wed 11 May 2005 14:24
by Ikar
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.