Subject Problem with IB_Session in a TRemoteDataModule
Author rugbyjocker
Hi,

I'm trying to rig up a remote data module (multi-instance, apartment
threaded) that has a TIBODatabase component on it, and that creates a
series of child remote data modules all created as 'internal'. My
TIBOQueries and data providers all live on these child remote data
modules. This works fine until two clients try to talk to the server
at once. Then the server locks up completely.

I've now made a new app with a single remote data module that is set
up as multi-instance and apartment threading, and on there I put a
TIBODatabase, a TIBOQuery and a data provider. Same problem. I've
tried adding a TIB_Session to the module, and assigning it to the
TIBODatase's and TIBOQuery's IB_Session property in the constructor.
It makes no difference. I feel like I'm fishing here.

If I change the threading model of the remote data module to 'single'
then it works fine, so clearly the problem lies with the way multiple
threads are talking to IBObjects (seeing as there is NOTHING else on
the data module at all).

I know I'm doing something daft here, but I can't see what it is.

Any help would be greatly appreciated.
Regards
Sandy MacPherson



For reference, here is the remote data module as it stands...

unit TestRDM;

{$WARN SYMBOL_PLATFORM OFF}

interface

uses
Windows, Messages, SysUtils, Classes, ComServ, ComObj, VCLCom,
DataBkr, DBClient, prjAppServer_TLB, StdVcl, Provider, DB, IBODataset,
IB_Components, IB_Session;

type
TTestServer = class(TRemoteDataModule, ITestServer)
db: TIBODatabase;
qry: TIBOQuery;
prv: TDataSetProvider;
session: TIB_Session;
procedure RemoteDataModuleCreate(Sender: TObject);
private
{ Private declarations }
protected
class procedure UpdateRegistry(Register: Boolean; const ClassID,
ProgID: string); override;
public
{ Public declarations }
end;

implementation

{$R *.DFM}

class procedure TTestesServer.UpdateRegistry(Register: Boolean; const
ClassID, ProgID: string);
begin
if Register then
begin
inherited UpdateRegistry(Register, ClassID, ProgID);
EnableSocketTransport(ClassID);
EnableWebTransport(ClassID);
end else
begin
DisableSocketTransport(ClassID);
DisableWebTransport(ClassID);
inherited UpdateRegistry(Register, ClassID, ProgID);
end;
end;

procedure TTestesServer.RemoteDataModuleCreate(Sender: TObject);
begin
db.IB_Session := session;
qry.IB_Session := session;
end;

initialization
TComponentFactory.Create(ComServer, TTestesServer,
Class_TestesServer, ciMultiInstance, tmSingle ??? tmApartment??);
end.