In my application one session can be used in two threads.
One of the threads has the timer to keep the session in active state besides query.
How to find out it is the moment to make a request to the server to maintain the session (in timer event)? Is there a flag in OraSession telling the session now is occupied for two thread won`t have the possibility to use the same session.
One session and two thread
Re: One session and two thread
Hello,
There is no such property in TOraSession that would be responsible for session "occupancy". However, since ODAC is a threadsafe product, you can use one and the same session in different threads without such checks, and this won't lead to errors.
There is no such property in TOraSession that would be responsible for session "occupancy". However, since ODAC is a threadsafe product, you can use one and the same session in different threads without such checks, and this won't lead to errors.
Re: One session and two thread
So do you want to say that if two threads ask the session to execute the query, two queries will be processed in the same session at the same time? Or in OraSession will be queue?
Re: One session and two thread
Hello,
In context of one session only one operation can be executed at a time, regardless of how many threads use one and the same session. If at the time the session is "busy", the next operation invoked from another thread will wait for completion of the current operation.
In context of one session only one operation can be executed at a time, regardless of how many threads use one and the same session. If at the time the session is "busy", the next operation invoked from another thread will wait for completion of the current operation.
Re: One session and two thread
Hi,
Best Regards,
Andre
Is direct mode threadsafe too? Documentation says it is not.AlexP wrote:There is no such property in TOraSession that would be responsible for session "occupancy". However, since ODAC is a threadsafe product, you can use one and the same session in different threads without such checks, and this won't lead to errors.
Best Regards,
Andre
Re: One session and two thread
Hello,
Yes, full thread-safety is really guaranteed in the OCI mode, we recommend to use a separate connection for each thread in the Direct mode, but you can try using one and the same connection for different threads, since we haven't received complains about thread-safety in this mode recently, and all the known problems are already fixed.
Yes, full thread-safety is really guaranteed in the OCI mode, we recommend to use a separate connection for each thread in the Direct mode, but you can try using one and the same connection for different threads, since we haven't received complains about thread-safety in this mode recently, and all the known problems are already fixed.