Subject Server Connection .v. Local Connection
Author ben_sollis
Hi all..

I am currently trying to connect to a server based database.

The database I wish to connect to is defined in a security db on the
local machine.

From this db, the name of the "real" database to be used is retrieved
and then sent to an AttachToDatabase function in my midas server.

Connecting to a local db works, but when I attempt to connect to a
server based db, delphi first brings up the CPU debugger, and then
after pressing F9, it seems to connect. (very slowely)

I then as in a C/S environment, hit retrieve to display a list of
records, which works, and I then double click a record to edit, at
which stage, I get an error reported in midas.dll.

The following is my connection code snipped somewhat.

Result := 0;
try
dbFreight.Connected := False;
with dbFreight.Params do
begin
S := DBase;
Clear;

I := Pos(':/', S);
if I > 0 then
begin
// Server Database..
I := Pos(':', S);
dbFreight.Server := Copy(S,1,I-1);
System.Delete(S, 1, I);
for I := 1 to Length(S) do if S[I] = '/' then S[I] := '\';
dbFreight.Path := S;
dbFreight.Protocol := cpTCP_IP;
end
else
begin
// Local Database..
for I := 1 to Length(S) do if S[I] = '/' then S[I] := '\';
dbFreight.Server := '';
dbFreight.Path := S;
dbFreight.Protocol := cpLocal;
end;
Add( 'PATH='+S );
Add( 'USER NAME='+UserName );
Add( 'PASSWORD='+UserPword );
Add( 'ENABLE BCD=FALSE' );
Add( 'SQLQRYMODE=SERVER' );
Add( 'SQLPASSTHRU MODE=SHARED NOAUTOCOMMIT' );
end;

dbFreight.Connected := True;

Some of this code has legacy stuff in it, which I am unsure yet as to
keep or delete.

Any help, comment would be much appreciated.

Ben