Multi threaded environment

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
JFlo
Posts: 9
Joined: Tue 23 Nov 2004 13:31

Multi threaded environment

Post by JFlo » Tue 23 Nov 2004 13:44

I have built a multi threaded process with one Oracle Database Session used by every thread (using DBSession->ThreadSafety = true;).
This seems to work, but not very stable. (The process crashes sometimes with obscure oracle errors, like allocation buffer to small or missing parameter)
a) Is this a supported environment?
b) should i better use AssignConnect() in every thread?
c) what value is best fo ThreadSafety?

Paul
Posts: 725
Joined: Thu 28 Oct 2004 14:06

Post by Paul » Fri 26 Nov 2004 10:49

a) Yes, TOraSession.ThreadSafety property turns OCI to thread safe mode and ODAC internal synchronization mechanism.
b) AssignConnect is not better than using one session per many threads. Source TOraSession and TOraSession copied by AssignConnect are identical to Oracle server. The best solution is to use the different TOraSession components for different threads. That is the only possible decision for Net-option.
c) The default value for ThreadSafety is True. It is the best for multithread applications.

Please send small demo project to demonstrate the problem and include script to create server objects (tables) to ODAC support email address.

Post Reply