Print Thread
Threads and TOracleSession
#6198 03/18/04 05:26 PM
Joined: Mar 2004
Posts: 2
Almere, Holland
P
PirIS Offline OP
Member
OP Offline
Member
P
Joined: Mar 2004
Posts: 2
Almere, Holland
I'm trying to build a NTservice that checks the contents of an Oracle DB. Via a thread (class TThread) i want to be able to check different DB's/schema's at the same time! How can i provide for a thread-session! (I'm a bit new to this thread stuff...) At the moment it seems that the first access is the one that gets the DB... frown

I'm not sure if what i just wrote is all clear to outsiders... confused


gR.oetjeS. / gR.eetingS.
roel
Re: Threads and TOracleSession
#6199 03/18/04 10:46 PM
Joined: Aug 1999
Posts: 22,208
Member
Offline
Member
Joined: Aug 1999
Posts: 22,208
If you want to access different databases from different threads simultaneously, you should create a TOracleSession instance within the thread, and free the session when the thread is finished. The same goes for any TOraclyQuery and other instances you want to use.

If each thread has its own session, you don't have to worry that threads block eachother at the session level.

If you need many queries, you can create a data module at design-time, and create a data module instance at the thread level instead. It is of course much easier to setup your components at design-time than at run-time.


Marco Kalter
Allround Automations
Re: Threads and TOracleSession
#6200 03/19/04 03:38 PM
Joined: Mar 2004
Posts: 2
Almere, Holland
P
PirIS Offline OP
Member
OP Offline
Member
P
Joined: Mar 2004
Posts: 2
Almere, Holland
Thanks for the confirmation of my own ideas...

But there comes the problem.
I'm not really into this sort of techniques!
I've 'stolen' from the InterNet the TThread programming, but i can't find anything (yet) over instanciating a datamodule on tue TThread unit!


gR.oetjeS. / gR.eetingS.
roel
Re: Threads and TOracleSession
#6201 03/21/04 02:40 PM
Joined: Nov 2003
Posts: 89
Germany
A
al0 Offline
Member
Offline
Member
A
Joined: Nov 2003
Posts: 89
Germany
[quote]Originally posted by PirIS:
Thanks for the confirmation of my own ideas...

But there comes the problem.
I'm not really into this sort of techniques!
I've 'stolen' from the InterNet the TThread programming, but i can't find anything (yet) over instanciating a datamodule on tue TThread unit!
[/quote]There is absolutely NOTHING SPECIAL. Just put constructor of DataModule into the Thread constructor. Delphi help contains more then enough information for working with threads. And several demo programs are supplied. Just take a look on them.


Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.058s Queries: 14 (0.008s) Memory: 2.5064 MB (Peak: 3.0393 MB) Data Comp: Off Server Time: 2024-05-04 02:39:11 UTC
Valid HTML 5 and Valid CSS