Posted By: Kashi TOracleQuery Threaded=True - 11/09/14 07:34 AM
Hello,

Possibly, a very basic question.

1. I have one OracleSession.
2. I have two TOracleQuerys - OracleQuery1 and OracleQuery2 both connected to OracleSession.
3. My purpose is to use OracleQuery1 for all user querying.
4. I intend to use OracleQuery2 for waiting on a dbms_alert.
5. I set OracleQuery2.Threaded = True and run this in a Timer event. The query inside OracleQuery2 is basically
begin
dbms_alert.waitone('MYEVENT', :out1, :out2);
end;

6. So, I start up the application, connect to Oracle and do dbms_alert.register('MYEVENT'). After this, I enable the timer so that it waits for an dbms_alert. The timer code is basically :
Timer1.enabled := False;
OracleQuery2.execute;
Memo1.Lines.add(DateTimeToStr(Now()));
Timer1.enabled := True;

7. While this is waiting, I would like to run queries using Oraclequery1.

Is this possible - can the Oraclesession be shared across threads?

Using TOracleEvent does work well but it creates another session.

Pl let me know if my question is unclear or has already been answered earlier. Open to considering other options.

My environment : Oracle 11.2.0.3.0 64 bit server
PC - Windows 7; Delphi 2010; DOA 4.1.2.2

Thanks in advance.
Kashi
Posted By: Marco Kalter Re: TOracleQuery Threaded=True - 11/10/14 10:38 AM
A TOracleSession can only do one thing at a time. So while it is waiting for a dbms_alert, it cannot perform any other activities. You will need a secondary TOracleSession for that.
Posted By: Kashi Re: TOracleQuery Threaded=True - 11/10/14 10:54 AM
Thank you - clarifies all.
© Allround Automations forums