Page 1 of 2
DisconnectedMode and threading
Posted: Tue 28 Apr 2009 02:12
by MarkF
I seem to have an issue with threading that only comes up if DisconnectedMode is True. I have a single session with Thread Safey on. I start a background thread which is running many small update statements. In a different thread I run a single query. If DisconnectedMode is False, then everything works fine. If DisconnectedMode is True, then I get various Oracle errors and access violations. It seems like some kind of mutexing/thread protection issue. Is that enough to look into it? I don't have a small example, but I can probably make one if needed. Thanks for any help or suggestions!
-Mark Ford
Benthic Software
Posted: Tue 28 Apr 2009 06:48
by Plash
DisconnectedMode is not designed for working with multiple threads. You can use DisconnectedMode only if you use separate TOraSession component for each thread.
Posted: Tue 28 Apr 2009 11:21
by MarkF
My only reason for using disconnected mode is so that I can disconnect (explicitly) from the database and have my datasets retain their data. Would it be possible to have some other way to do this? Perhaps a Disconnect procedure on the dataset class? It seems like DevArt has already done most of the work to make it possible, so perhaps it's not a major addition? Thanks for any comments.
-Mark
Posted: Wed 29 Apr 2009 12:28
by Plash
We will add this method in the next ODAC build.
Posted: Wed 29 Apr 2009 14:06
by MarkF
You guys rock! Thanks.
Posted: Wed 27 May 2009 11:51
by Ludek
Will this method also be available in SDAC?
Posted: Wed 27 May 2009 11:54
by Plash
We have considered to make the Disconnected property instead of method. This property will be available in SDAC.
Posted: Wed 27 May 2009 12:02
by Ludek
so if i want to disconnect a connection and leave my datasets open, i set disconnected := true, when I again want to connect, i set disconnected := false?
Posted: Thu 28 May 2009 06:39
by Plash
You should set the Disconnected property of the dataset to True, if you want to leave the dataset opened after the connection is closed.
You don't need to set Disconnected to False.
We have released the new build with this property.
Posted: Thu 28 May 2009 06:57
by Ludek
I need that no dataset closes on disconnect. what do you propose is the best approach? before disconnect somehow enumerate all datasets and set their disconnected property to true?
Posted: Thu 28 May 2009 07:35
by Plash
Set Disconnected := True just after you create a dataset.
Posted: Thu 28 May 2009 09:40
by Ludek
easy to write, hard to realize, especially if i have many thousands queries on many thousand .dfm forms and next thousands directly in code... (and thousands in future code, where i certainly would forget it)

i'll give a next try to disconnectedmode := true and manual calling of the connect method. a hope, it will really work now as designed and no more disconnect itself...
Posted: Wed 03 Jun 2009 07:32
by Ludek
once again: can I use disconnected mode in other thread or not? i'm creating and using the db connection in the other thread, but i still get disconnected after each command sent...? in main thread it works fine...
Posted: Thu 04 Jun 2009 09:27
by Plash
You can use DisconnectedMode in a thread if you work with a session in this thread only.
If you use one session from several threads, DisconnectedMode does not work properly.
Posted: Thu 04 Jun 2009 15:00
by Ludek
i meant again sdac, AFAIK there are no sessions. at least i don't know anything about it...?
i make new post in sdac forum...