OracleEvent Set_Client_Info does not work

It is very useful to Set_Client_Info with every session since you can view this in Oracle's V$Session View.
TOracleEvent creates a new session where I want to apply the same principle by using

OracleEvent1.Start;

and then

OracleEvent1.InternalSession.DBMS_Application_Info.Set_Client_Info('My Info');

However this does not work. Moreover the whole Application aborts without any error message. Whats wrong with this? I'm using DOA 3.4 with Delphi 7.

Chris
 
The InternalSession can only be used within the TOracleEvent event handlers. Otherwise the session will be busy waiting for events. Therefore you should probably use the OnStart event to set session properties. For example:

Code:
procedure TMyForm.MyOracleEventStart(Sender: TOracleEvent);
begin
  Sender.InternalSession.DBMS_Application_Info.Set_Client_Info('My Info');
end;
 
Hmm, you're right. This is part of the TOracleEvent.Start code:

Code:
// Fire the OnStart event
  if Assigned(FOnStart) then FOnStart(Self);
  // Logon
  InternalSession.Connected := True;

In other words, you can connect the InternalSession in your OnStart event handler as well:

Code:
procedure TMyForm.MyOracleEventStart(Sender: TOracleEvent);
begin
  Sender.InternalSession.Connected := True;
  Sender.InternalSession.DBMS_Application_Info.Set_Client_Info('My Info');
end;

The subsequent Connected := True assignment in the Start procedure has no effect (i.e. it will not disconnect and reconnect, but will be ignored).
 
Back
Top