Hi.
I have the following application
:
Delphi 6, Ibx6.08. Client server
application. Dcom Connection.
The Server is setup :
1) Main Remote
data module(rdmMain), with a TibDatabase and TIbTransaction. ciMultiInstance,
tmApartment.
2) Many child remote data modules. They have IbQueries
pointing( at design time ) to the TIbDatabase
of
the main remote data module(rdmMain). ciInternal, tmApartment.
According to the documentation, as the
child remote data modules are internal, they can only be seen by
the
thread that created them.
When I try to run this application, and
connect multiple clients to the same app server, the program
crashes.
The problem (I think) is :
1) When first client connects, one rdmMain
is created( and added to the Screen global variable in
Screen.DataModules as
"MainRdm").
When child rdms are read from the
stream, the TibQueries read their database properties and set
it
to point to
"MainRdm.Database").
2) When the second client connects,
another rdmMain is created( and added to the Screen global variable in
Screen.DataModules as "MainRdm_1" -> changes
the name ).
When child rdms are read from the
stream, the TibQueries read their database properties and set
it
to point to "MainRdm.Database", NOT
"MainRdm_1").
So, I end up with queries in the second
COM object looking at a database in the first COM object. Which,
in theory,
should be running in a different thread.
Now, I already know a work around( setting
the tibdatabase when the rdm is created ). What I'd like to know is
:
1) Is the way the Delphi code works
correct ? Has it been changed in Delphi 7 or 8 ( ie : does the global list of
datamodules consider which thread they are created in )?
2) Are there any other things that will be global to all of the com
objects created ? The "main" form comes to
mind, is there
anything else ? Which is the code that has to be made thread safe
?
Thanks very much for the info
Regards
Paul McKenzie
Analyst
Programmer
SMSS Ltd.