Trigger at logon

Dear Experts,
I create a user JONES with a given pass.
I create in SYSTEM schema a TRIGGER:
CREATE OR REPLACE TRIGGER JONES_trg
AFTER logon ON JONES.SCHEMA
BEGIN
EXECUTE IMMEDIATE 'alter session set current_schema = PRODUCTION';
END JONES_trg;
So when JONES logs on he's redirected to PRODUCTION schema.
I'd like to use the same mechanism but based on the name of the workstation he's using to connect.
For example if he connects from Machine1, he'll be connected to schema PRODUCTION and to schema DEVELOPMENT if he connects from Machine2. How can I retrieve the relevant information from a sqlplus session ?
Any advice is greatly appreciated.
Regards,
Jerome.

Hi Jerome,
You can find the machine name in the v$session view. Checkout the "Terminal" column.
-Raj Suchak
[email protected]

Similar Messages

  • Trigger after logon

    Hi,
    I created a trigger to avoid users to run commands outside the Forms/Reports environment, which means they must execute their commands using the Application servers (App1 and App2, machine column, in v$session).
    I need to send them the message "YOU MUST RUN YOUR COMMANDS USING FORMS" when a user called TST01 is TRYING to connect to the database , running Forms outside App1 or App2 machines .
    Here is the code:
    CREATE OR REPLACE TRIGGER tr_lock_user_out_forms
    AFTER LOGON ON DATABASE
    DECLARE
    v_user sys.v_$session.username%TYPE;
    v_mac sys.v_$session.machine%TYPE;
    BEGIN
    SELECT username, machine
    INTO v_user, v_mac
    FROM sys.v_$session
    WHERE audsid = USERENV('SESSIONID')
    AND audsid != 0
    AND ROWNUM = 1;
    EXCEPTION WHEN NO_DATA_FOUND THEN NULL;
    IF (UPPER(v_user) = 'TST01') THEN
    BEGIN
         IF LOWER(v_mac) NOT IN ('app1', 'app2')
         THEN
              RAISE_APPLICATION_ERROR(-20000, 'YOU MUST RUN YOUR COMMANDS USING FORMS');
         END IF;
    END;
    END IF;
    END;
    SHOW ERRORS
    It's allowing user TST01 to connect to the db. Do you guys have any idea ?
    Thanks in advance.

    Thanks for the replies,
    Naresh , the idea is to avoid users to connect to the DB without using Oracle Forms, and the message that the user would receive could be "PLEASE, CONNECT TO THE DATABASE USING FORMS ON AAP1 OR APP2" (sorry if the message I wrote before was unclear).
    So, the users could not even connect to the DB if they are not login using Forms. Your idea is good but we have 3.000 tables for this user to access, and as after update cannot be used in schema or database levels, I think it won't worth using this event.
    I'm trying other code but if any of you guys have another idea to correct the code below it'd be nice.
    Thkx in advance.

  • Calling set_context() outside after logon trigger?

    Hello all
    I'm trying out and learning on using the application context so I tried out the tutorials from: Oracle® Database Security Guide 11g Release 1 (11.1) B28531-06 document (well, very similar examples that is)
    I made a procedure which should retreive the employee_id based on the provided user_name (a logical user_name stored in a table) and set an (attribute, value) pair using the dbms_session.set_context()...
    select employee_id into emp_id from user_pswd_table where user_name like p_user_name;
    DBMS_SESSION.SET_CONTEXT('employee_id_ctx', 'employee_id', emp_id);
    and (the tester) the call of the procedure looked like something like this:
    declare usernm varchar2(30);
    begin
    usernm :='user_name_which_will_be_provided';
    set_employee_id_pck.set_employee_id_ctx(usernm);
    end;
    but as it seams like it is only working if the call is made from the after logon on database trigger...if that's the case after the next log on I have the needed information retrieved with select sys_context(...) from dual, but if that's not the case if I call that procedure from anywhere else it results with no_data_found.
    Could someone please explain to me why is that???
    Thx in advance :D
    Ildiko

    Sorry Frank, the message for Ildiko.
    You found below context example
    Login with  user  scott :
    -- creation table  dossiers
    SQL> connect scott/tiger@oratest
    Connected.
    --creation de la table dossiers
    CREATE TABLE DOSSIER(
      NO_DOS    NUMBER(6),
      DT_DOS    DATE,
      TYPE_DOS  VARCHAR2(50) CHECK (TYPE_DOS IN ('SECRET','NORMAL'))
    --Insertions in table dossiers
    SQL> insert into dossier values(1,trunc(sysdate),'SECRET');
    1 row created.
    SQL> insert into dossier values(2,trunc(sysdate),'SECRET');
    1 row created.
    SQL> insert into dossier values(3,trunc(sysdate),'SECRET');
    1 row created.
    SQL> insert into dossier values(4,trunc(sysdate),'NORMAL');
    1 row created.
    SQL> insert into dossier values(5,trunc(sysdate),'NORMAL');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select * from dossier;
        NO_DOS DT_DOS    TYPE_DOS
             1 22-MAY-07 SECRET
             2 22-MAY-07 SECRET
             3 22-MAY-07 SECRET
             4 22-MAY-07 NORMAL
             5 22-MAY-07 NORMAL
    -- Logon with  user sys :
    -- Attribution  grants
    grant execute on dbms_rls to scott;
    grant execute on dbms_session to scott;
    grant ADMINISTER DATABASE TRIGGER  to scott;
    grant alter session to scott ;
    --Logon with user system : 
    --Création et attribution  rôles
    Create role sec_employe ;
    Create role sec_manager;
    Grant select, update,insert, delete on scott.dossier to sec_employe ;
    Grant select, update,insert, delete on scott.dossier to sec_manager;
    Grant sec_manager to scott;
    Grant create any context to scott;
    grant create table to scott;
    grant create procedure to scott;
    -Logon with  user  scott :
    -- Création context  package 
    SQL> create or replace package pkg_dossier_context
      2   is
      3     procedure set_manager;
      4     procedure set_employe;
      5    end;
    Package created.
    SQL> create or replace package body pkg_dossier_context
      2       as
      3   procedure set_manager
      4      is
      5    begin
      6       dbms_session.set_context('scott_dossier','app_role','manager');
      7    end;
      8           --
      9    procedure set_employe
    10       is
    11     begin
    12       dbms_session.set_context('scott_dossier','app_role','employe');
    13     end;
    14   end;
    Package body created.
    -- Création  context
    SQL> create or replace context scott_dossier using pkg_dossier_context;
    Context created.
    -- Création du  package de sécurité
    SQL> create or replace package pkg_dossier_sec
      2    as
      3       function dossier_predicate(schema_name in varchar2, object_name in varchar2)
      4         return varchar2;
      5   end;
    Package created.
    SQL> create or replace package body pkg_dossier_sec
      2     as
      3        function dossier_predicate(schema_name in varchar2,object_name in varchar2)
      4         return varchar2
      5         is
      6                 lv_predicate varchar2(1000):='';
      7         begin
      8                 if sys_context('scott_dossier','app_role') = 'manager' then
      9                         lv_predicate:='type_dos=''SECRET'''; -- a le droit de voir uniquement
                                              --     les dossiers de type SECRET
    10                elsif sys_context('scott_dossier','app_role') = 'employe' then
    11                        lv_predicate:='type_dos=''NORMAL'''; -- a le droit de voir uniquement
                                          --les dossiers de type NORMAL
    12                 else
    13                        lv_predicate:='1=2'; -- block access
    14                end if;
    15               return lv_predicate;
    16        end;
    17     end;
    Package body created.
    -- Add la policy (politique)
    SQL> begin
    2        dbms_rls.add_policy(
    3                  object_schema => 'SCOTT',
    4                  object_name => 'DOSSIER',
    5                  policy_name => 'SCOTT_DOSSIER_POLICY',
    6                  function_schema => 'SCOTT',
    7                  policy_function => 'pkg_dossier_sec.dossier_predicate',
    8                   statement_types => 'select, insert, update, delete',
    9                   update_check => TRUE,
    10                  enable => TRUE,
    11                  static_policy => FALSE);
    12   end;
    PL/SQL procedure successfully completed.
    -- Création du trigger on logon
    SQL>  create or replace trigger scott_logon_trigger
      2     after logon on database
      3    declare
      4     NB VARCHAR2(30) ;
      5   begin
      6       select granted_role
      7        into nb
      8        from dba_role_privs
      9        where grantee='SCOTT' and granted_role='SEC_MANAGER' ;
    10        pkg_dossier_context.set_manager;
    11      exception
    12         when no_data_found then
    13         pkg_dossier_context.set_employe;
    14   end;
    Trigger created.
    PL/SQL procedure successfully completed.
    SQL> SELECT * FROM DOSSIER;
        NO_DOS DT_DOS    TYPE_DOS
             1 22-MAY-07 SECRET
             2 22-MAY-07 SECRET
             3 22-MAY-07 SECRET
    Explication :
    Scott a le rôle sec_manager donc il a le droit de voir uniquement  les dossiers  de type SECRET,
    une clause de restriction  se rajoute à ma requête initiale,
    elle devient :SELECT * FROM DOSSIERS  WHERE  type_dos='SECRET' ;
    -- Connect with user system :  
    SQL> revoke sec_manager from scott;
    Revoke succeeded.
    SQL> grant sec_employe to scott;
    Grant succeeded.
    --Connect with  user  scott :
    SQL> connect scott/tiger@oratest;
    Connected.
    SQL> select * from dossier;
        NO_DOS DT_DOS    TYPE_DOS
             4 22-MAY-07 NORMAL
             5 22-MAY-07 NORMAL
    --Pour enlever le policy
    SQL>  begin
      2          dbms_rls.drop_policy(
      3           object_schema => 'SCOTT',
      4           object_name => 'DOSSIER',
      5           policy_name => 'SCOTT_DOSSIER_POLICY');
      6   end;
    PL/SQL procedure successfully completed.
    SQL> select * from dossier;
        NO_DOS DT_DOS    TYPE_DOS
             1 22-MAY-07 SECRET
             2 22-MAY-07 SECRET
             3 22-MAY-07 SECRET
             4 22-MAY-07 NORMAL
             5 22-MAY-07 NORMALEdited by: Salim Chelabi on 2008-12-16 10:54
    Edited by: Salim Chelabi on 2008-12-16 11:26

  • I Need Help with the LOGON Built-in

    Hello I have the following problem, I have a code implemented in the trigger ON-LOGON I will show them the code.
    DECLARE
    --Numero de Intentos Permitidos
    num_intentos NUMBER :=3;
    --Variables de Coneccion
    usu VARCHAR2(80);
    pass VARCHAR2(80);
    conec VARCHAR2(80);
    upc VARCHAR2(200);
    coneccion BOOLEAN:=FALSE;
    --Numero de Erro
    num_error NUMBER;
    BEGIN     
         --Ciclo que controla el numero de intentos
         FOR i IN 1..num_intentos
         LOOP
         --Muestra la pantalla logon de Oracle Forms
         LOGON_SCREEN;
         --Se recupera los valores de la coneccion.
         usu := GET_APPLICATION_PROPERTY(USERNAME);
         pass := GET_APPLICATION_PROPERTY(PASSWORD);
         conec := GET_APPLICATION_PROPERTY(CONNECT_STRING);
    --Digito Cancel
    IF NOT FORM_SUCCESS THEN
    k_mensajes.push('No es posible establecer la Coneccion, Contacte con el Administrador del Sistema','E');
    EXIT;
    END IF;
    --Se Desconecta cualquier session
    LOGOUT;
    --Verificamos que los datos de coneccion no esten nulos
    IF ((usu IS NULL) AND (pass IS NULL) AND (conec IS NULL)) THEN
         k_mensajes.push('Los Datos para establecer la Coneccion estan incompletos','E');
    RETURN;
    END IF;
    --Realizando la coneccion
    IF ((usu IS NOT NULL) AND (pass IS NOT NULL) AND (conec IS NOT NULL)) THEN
         LOGON(usu,pass||'@'||conec,FALSE);
         num_error:=DBMS_ERROR_CODE;     
    ELSE
         LOGON(usu,pass,FALSE);
         num_error:=DBMS_ERROR_CODE;
         coneccion :=FALSE;
    END IF;     
    RETURN;
    --Finalizando el Ciclo  
         END LOOP;
         IF NOT coneccion THEN
    RAISE FORM_TRIGGER_FAILURE;
    END IF;
    END;
    The problem is that when I capture the the I number of error, I pass it to the ON-ERROR and of there I verify that I number of error it is and I throw the message, but I am not able to contralar the sequence among the triggers.
    I will show them the code of the trigger ON-ERROR:
    DECLARE
         --Numero de Error
         num_error NUMBER;
    BEGIN
         num_error:=DBMS_ERROR_CODE;
    --Se Verifica el Tipo de Error
    IF num_error= -1017 THEN
         --El Usuario ingreso mal la contraseña
         k_mensajes.push('El Password Ingresado no es Valido.','E');
         LOGON_SCREEN;     
    ELSIF num_error= -28000 THEN
         --El Usuario esta Bloqueado
         k_mensajes.push('El Usuario esta Bloqueado, Contacte con el Administrador del Sistema.','E');
    ELSIF num_error= -28002 THEN
         --La Contraseña del Usuario ha Expirado
         k_mensajes.push('Su Password va Expirar, favor cambiarla antes de que Expire.','E');
         CALL_FORM (lower('S_SEG_CAMBPASS'),NO_HIDE,DO_REPLACE);
    --======> Cuando el valor es 0 indica que la coneccion fue establecida <=====     
    ELSIF num_error= 0 OR num_error IS NULL THEN
         NULL;
    --======>Cuando el valor es -24309 hay una sesion conectada, se realiza la desconeccion de esa sesion. <======     
    ELSIF num_error= -24309 THEN
         NULL;
         LOGOUT;
    ELSIF num_error= -1403 THEN
         NULL;
    ELSE
         --Si es otro error
         k_mensajes.push('Error al Ingresar '||TO_CHAR(num_error)||', Contacte con el Administrador del Sistema','E');
         NULL;
    END IF;
    END;
    If somebody can help me or to indicate me where this my error, because I need to look for the way to tell to the user that this blocked, or that I enter bad their password.

    Hi!
    I think this will help us:
    declare
       --Numero de Intentos Permitidos  == number of allowed ....
       num_intentos                                 number := 3;
       --Variables de Coneccion  == connection variables
       usu                                          varchar2( 80 );
       pass                                         varchar2( 80 );
       conec                                        varchar2( 80 );
       upc                                          varchar2( 200 );
       coneccion                                    boolean := false;
       num_error                                    number;
    begin
       --Ciclo que controla el numero de intentos
       for i in 1 .. num_intentos
       loop
          --show Oracle Forms logon screen
          logon_screen;
          --save connection settings
          usu := get_application_property( username );
          pass := get_application_property( password );
          conec := get_application_property( connect_string );
          -- Exit the loop
          if not form_success
          then
             k_mensajes.push
                ( 'No es posible establecer la Coneccion, Contacte con el Administrador del Sistema'
              , 'E' );
             exit;
          end if;
          -- Disconnect
          logout;
          -- Test for null values
          if (     ( usu is null )
              and ( pass is null )
              and ( conec is null ) )
          then
             k_mensajes.push( 'Los Datos para establecer la Coneccion estan incompletos'
              , 'E' );
             return;
          end if;
          -- now make the connection
          if (     ( usu is not null )
              and ( pass is not null )
              and ( conec is not null ) )
          then
             logon(
                usu
              , pass || '@' || conec
              , false );
             num_error := dbms_error_code;
          else
             logon(
                usu
              , pass
              , false );
             num_error := dbms_error_code;
             coneccion := false;
          end if;
          return;
       end loop;
       if not coneccion
       then
          raise form_trigger_failure;
       end if;
    end;And then:
    declare
       num_error                                    number;
    begin
       num_error := dbms_error_code;
       -- discern error type
       if num_error = -1017
       then
          --password entered is invalid
          k_mensajes.push( 'El Password Ingresado no es Valido.', 'E' );
          logon_screen;
       elsif num_error = -28000
       then
          --user is blocked
          k_mensajes.push
                   ( 'El Usuario esta Bloqueado, Contacte con el Administrador del Sistema.'
           , 'E' );
       elsif num_error = -28002
       then
          --password is expired
          k_mensajes.push( 'Su Password va Expirar, favor cambiarla antes de que Expire.'
           , 'E' );
          call_form(
             lower( 'S_SEG_CAMBPASS' )
           , no_hide
           , do_replace );
       --======> 0 means that the connection was succesfully made <=====
       elsif    num_error = 0
             or num_error is null
       then
          null;
       --======>Cuando el valor es -24309 hay una sesion conectada, se realiza la desconeccion de esa sesion. <======
       -- think this means something like 'there is a connection, but we have to end it'
       elsif num_error = -24309
       then
          null;
          logout;
       elsif num_error = -1403
       then
          null;
       else
          --other error
          k_mensajes.push('Error al Ingresar '
             || to_char( num_error )
             || ', Contacte con el Administrador del Sistema'
           , 'E' );
          null;
       end if;
    end;In you on-logon trigger you have entered some return statements. These will omit you last segment of code:
       if not coneccion
       then
          raise form_trigger_failure;
       end if;I don't think you want to skip this. but then again, this is a confusing segment as well:
          else
             logon(
                usu
              , pass
              , false );
             num_error := dbms_error_code;
             coneccion := false;
          end if;You make a connection but then you set the variable 'coneccion' to false. Why?
    Furthermore, I am not sure that form_success gives you the info you want. It will only tell you whether the very last statement before the call to form_succes, was successfull. In your case, that is
          conec := get_application_property( connect_string );which, I believe, will not fail in your code.
    Hope this helps!
    Grtx
    Remco

  • How to run the form without logon?

    sir:
    I want to create the application without logon,but before the
    form appear,I must logon, I want to know how to run the form
    without logon(comment:I don't connect to database!);
    null

    steve (guest) wrote:
    : Create trigger ON-LOGON. Supply alternative logon code
    : or NULL; if you want to do nothing. Form will execute
    : but will not produce logon window.
    : gang lee (guest) wrote:
    : : sir:
    : : I want to create the application without logon,but before
    the
    : : form appear,I must logon, I want to know how to run the form
    : : without logon(comment:I don't connect to database!);
    Mr steve,thanks for your help!
    null

  • How to display a logon-message without a diconnect

    Hello,
    I tried to display a message on logon with a trigger on logon and a RAISE_APPLICATION_ERROR, but this disconnects the user or doesn't worl for DBA-users.
    Is the any other possibilty to display a message when somebody logs on ?
    Regards,
    Mynz

    Mynz wrote:
    Hello,
    I want to implement something like a license-check.
    The end-user should get a message when exceeding the license limit, but not being disconnected. Means, he can go on working, but he is informed that licenses are missing and he shoud buy some more ;-)
    And I don't want to change all our applications...
    Regards,
    Mynz
    Your application is what is responsible for taking whatever the database sends and determining what it wants to do with that.
    You use sqlplus as an example, but as far as the database is concerned, sqlplus is just another application making a connection and sending requests.  The behavior of what sqlplus is displaying is not the result of something in the database, it is the result of how sqlplus is coded to handle what the database sends it.
    Your application is no different. 

  • Trigger failed ?

    I wrote a trigger on "Logon on database" to call a procedure on every login/session is changed. Its working when i login with DBA. But trigger failed when i change session to SCOTT or other users who has no DBA role.
    My trigger code is:
    SQL> create or replace trigger logtrig after logon on database
              call myproc(parameters)
    SQL>connect  sys/xxxxxxxx            ---- its ok
    SQL>connect  myora/xxxxxxxxx      ----- its ok  (myora is dba)
    but when i connect to :
    SQL> conn scott/tiger
    ERROR:
    ORA-04098: trigger 'SYS.LOGONTRIG' is invalid and failed re-validation
    Warning: You are no longer connected to ORACLE. ---What is the reason?

    Until the trigger either compiles successfully or is dropped, users without the DBA role will not be able to logon to the database.
    By default, only the SYS and SYSTEM users are granted the DBA role.

  • Plz help prob with a query and.. a trigger

    hi..
    1)i've created a view.gave the commit..
    now when i execute this query i get no rows selected...
    sql>select text from user_views where view_name='d1_v';even when i give sql>select * from user_views; all i see are column names and nothing else..
    do i need to grant my user any privilige. my user has create any view privilige.
    2)
    is it possible for me to create a trigger that updates records by itself for every 6 months by adding 1000 to the sal field
    i tried
    create or replace trigger after logon on emp ..............like that
    but i receive an error saying system triggers cannot be based on tables or views..
    plz help me out..
    thank u
    rajiv

    1. Try "select text from user_views where view_name='D1_V';
    BTW, no need to use "commit", CREATE VIEW is a DDL command, and DDLs do implicit commit.
    2. Why do you want to use triggers ? You can do that in at least two other ways : cron jobs and Oracle jobs.

  • UE-V 2.0 AppvPublishState.xml only triggers at logon

    Hi,
    I can only get the Microsoft produced AppvPublishState.xml U-EV template catalog to trigger at logon.  When I make a configuration change inside an App-V application the settings are saved correctly to %AppData%\Microsoft\AppV\Client\VFS, but when I
    close the app the U-EV settings storage path is not updated with the changes.  I've tried manually performing a Sync-AppvPublishingServer, restarting the App-V Client service and restarting the U-EV service to no avail.  Even at logoff U-EV
    is not updating.  Any suggestions?
    Here's a run down of my environment:
    Windows 7 stateless guests
    U-EV 2.0 with the following settings -
    SyncEnabled=True                                                          
    SyncMethod=None
    App-V 5.0 SP2 HF4
    No roaming profiles or folder redirection

    So,
    As it turns out the behaviour is by design.  There are two things to keep in mind:
    The powershell cmdlet Sync-AppvPublishingServer does not equal the trigger process SyncAppvPublishingServer.exe.  When I launched 'C:\Program Files\Microsoft Application Virtualization\Client\SyncAppvPublishingServer.exe' U-EV triggered as was expected.
    The Microsoft documentation explicitly states that (http://technet.microsoft.com/en-us/library/dn659478.aspx): 'With Hotfix Package 4 for Application Virtualization 5.0
    SP2 the user refresh on log on is initiated by SyncAppvPublishingServer.exe. This change was introduced to provide UPM solutions a trigger process.'  Thus, the trigger for AppvPublishStat.xml
    will only trigger at log on by default.

  • How to send a mail thru Oracle

    Hello Every one ,
    Can u plz tell me the way to send a mail thru oracle...................

    Follow the below steps..........
    INTRODUCTION:
    This bulletin explains how to programmatically send a fax/email message from a
    Forms/Reports application via Microsoft Exchange without any kind of user
    interaction. It shows the general usage of the 'Mail' package as well as a fully
    coded Forms sample application.
    The concept of OLE (Object Linking and Embedding) automation is used to control
    the OLE server application (Microsoft Exchange) using the client application.
    The client in this case may be a Developer/2000 Forms or Reports application. It
    uses the objects and methods exposed by the OLE Messaging Library which are
    much more robust than the MSMAPI OCX controls and allow access to many more MAPI
    properties.
    Oracle provides support for OLE automation in its applications by means of the
    OLE2 built-in package. This package contains object types and built-ins for
    creating and manipulating the OLE objects. Some of these built-ins for e.g.
    OLE2.create_obj, OLE2.invoke, OLE2.set_property have been extensively used in
    the code.
    GENERAL USAGE:
    The Mail package contains three procedures:
    1. Procedure Mail_pkg.logon( profile IN varchar2 default NULL);
    Use this procedure to logon to the MS Exchange mail client. The procedure
    takes a character argument which specifies the Exchange Profile to use for
    logon. Passing a NULL argument to the logon procedure brings up a dialog box
    which asks you to choose a profile from a list of valid profiles or create a new
    one if it doesn't exist.
    2. Procedure Mail_pkg.send(
    --------- Recipient IN varchar2,
    Subject IN varchar2 default NULL,
    Text IN varchar2 default NULL,
    Attachment IN varchar2 default NULL
    This is the procedure that actually sends the message and attachments, if
    any, to the recipient. The recipient may be specified directly as a valid email
    address or as an alias defined in the address book. If the message is intended
    for a fax recipient then a valid alias must be used that is defined as a fax
    address in the address book.
    3. Procedure Mail_pkg.logoff;
    This procedure closes the Exchange session and deallocates the resources used
    by the OLE automation objects.
    SAMPLE FORMS APPLICATION:
    1. Create the Mail Package using the following two Program Units:
    (a) Mail Package Spec
    (b) Mail Package Body
    Mail Package Spec:
    PACKAGE Mail_pkg IS
    session OLE2.OBJ_TYPE; /* OLE object handle */
    args OLE2.LIST_TYPE; /* handle to OLE argument list */
    procedure logon( Profile IN varchar2 default NULL );
    procedure logoff;
    procedure send( Recp IN varchar2,
    Subject IN varchar2,
    Text IN varchar2,
    Attch IN varchar2
    END;
    Mail Package Body:
    PACKAGE BODY Mail_pkg IS
    session_outbox OLE2.OBJ_TYPE;
    session_outbox_messages OLE2.OBJ_TYPE;
    message1 OLE2.OBJ_TYPE;
    msg_recp OLE2.OBJ_TYPE;
    recipient OLE2.OBJ_TYPE;
    msg_attch OLE2.OBJ_TYPE;
    attachment OLE2.OBJ_TYPE;
    procedure logon( Profile IN varchar2 default NULL )is
    Begin
    session := ole2.create_obj('mapi.session');
    /* create the session object */
    args := ole2.create_arglist;
    ole2.add_arg(args,Profile);/* Specify a valid profile name */
    ole2.invoke(session,'Logon',args);
    /* to avoid the logon dialog box */
    ole2.destroy_arglist(args);
    End;
    procedure logoff is
    Begin
    ole2.invoke(session,'Logoff');
    /* Logoff the session and deallocate the */
    /* resources for all the OLE objects */
    ole2.release_obj(session);
    ole2.release_obj(session_outbox);
    ole2.release_obj(session_outbox_messages);
    ole2.release_obj(message1);
    ole2.release_obj(msg_recp);
    ole2.release_obj(recipient);
    ole2.release_obj(msg_attch);
    ole2.release_obj(attachment);
    End;
    procedure send( Recp IN varchar2,
    Subject IN varchar2,
    Text IN varchar2,
    Attch IN varchar2
    )is
    Begin
    /* Add a new object message1 to the outbox */
    session_outbox := ole2.get_obj_property(session,'outbox');
    session_outbox_messages := ole2.get_obj_property(session_outbox,'messages');
    message1 := ole2.invoke_obj(session_outbox_messages,'Add');
    ole2.set_property(message1,'subject',Subject);
    ole2.set_property(message1,'text',Text);
    /* Add a recipient object to the message1.Recipients collection */
    msg_recp := ole2.get_obj_property(message1,'Recipients');
    recipient := ole2.invoke_obj(msg_recp,'add') ;
    ole2.set_property(recipient,'name',Recp);
    ole2.set_property(recipient,'type',1);
    ole2.invoke(recipient,'resolve');
    /* Add an attachment object to the message1.Attachments collection */
    msg_attch := ole2.get_obj_property(message1,'Attachments');
    attachment := ole2.invoke_obj(msg_attch,'add') ;
    ole2.set_property(attachment,'name',Attch);
    ole2.set_property(attachment,'position',0);
    ole2.set_property(attachment,'type',1); /* 1 => MAPI File Data */
    ole2.set_property(attachment,'source',Attch);
    /* Read the attachment from the file */
    args := ole2.create_arglist;
    ole2.add_arg(args,Attch);
    ole2.invoke(attachment,'ReadFromFile',args);
    ole2.destroy_arglist(args);
    args := ole2.create_arglist;
    ole2.add_arg(args,1); /* 1 => save copy */
    ole2.add_arg(args,0); /* 0 => no dialog */
    /* Send the message without any dialog box, saving a copy in the Outbox */
    ole2.invoke(message1,'Send',args);
    ole2.destroy_arglist(args);
    message('Message successfully sent');
    End;
    END;
    2. Create a block called MAPIOLE with the following canvas layout:
    |-------------------------------------------------------------|
    | |
    | Exchange Profile: |====================| |
    | |
    | To: |============================| |
    | |
    | Subject: |============================| |
    | |
    | Message: |============================| |
    | | | |
    | | | |
    | | | |
    | | | |
    | | | |
    | |============================| |
    | |-----| |
    | Attachment: |============================| |SEND | |
    | |-----| |
    |-------------------------------------------------------------|
    The layout contains 5 text-itmes:
    - Profile
    - To
    - Subject
    - Message (multiline functional property set to true)
    - Attach
    and a 'Send' button with the following WHEN-BUTTON-PRESSED trigger:
    mail_pkg.logon(:profile);
    mail_pkg.send(:to,:subject,:message,:attch);
    mail_pkg.logoff;

  • Moving to OID, but...

    hi! currently i'm using the Oracle 9iAS and Portal (both Release 1) to:
    1. develop pl/sql base applications. I make use of the local security tables (wwsec_person$ etc) to grant access to applications, content areas and folders etc.
    2. a trigger that uses system event trigger "after logon on portal30.schema" to call a procedure after a user logs in
    3. some dynamic pages that has e.g., the following:
    <Oracle>
    declare cursor b_day is
    Select * from portal30.wwsec_person$ where id = portal30.wwctx_api.get_user_id;
    b_rec b_cur%rowtype;
    begin
    For b_rec in b_cur loop
    htp.p('Hello');
    htp.p(b_rec.user_name);
    htp.p('Your birthdate is');
    htp.p(b_rec.date_of_birth);
    end;
    </Oracle>
    Questions:
    a) Can I just "switch" the "Authentication Mechanism: LOCAL" under the Edit Login Server portlet to OID? if so, how? will i need to reassign all the access rights again in the content area, folder, applications etc.
    b) what happens to all the user/group created under the wwsec_person$ etc? can I just "port them over"? if possible, how?
    c) are those commands in Q3 still valid? if not, how can I achieve the same result?
    also, the 9iAS Release 2 has actually "integrated" the OID with the portal. Should I just discard everything done on Release1 and re-create them on the R2?
    kindly advise.
    thank you.

    That is because you used a jar that is outside of your a2g.ear. That Oracle9iAS R2 doesn't seem to pick up your jars in the lib folder!!

  • Oracle 11g forms + SSO configuration

    Hi,
    We are having a forms 11g application and we are trying to configure the same with oracle SSO. But when I set the ssoMode=true in the formsweb.cfg file and hit the url, i just get a page with a "Oracle SSO" line at the top of the page and nothing else.
    I have put the following in the mod_osso.conf file in the AS.
    The highlighted portion is the addition that I did to the config file.
    Can anyone help me out with what needs to be done to get the forms application go to the oracle SSO page?
    +LoadModule osso_module "${ORACLE_HOME}/ohs/modules/mod_osso.so"+
    +<IfModule osso_module>+
    +OssoIpCheck off+
    +OssoIdleTimeout off+
    +#+
    +# Insert Protected Resources: (see Notes below for+
    +# how to protect resources)+
    +#+
    +#______-+
    +#+
    +# Notes+
    +#+
    +#______-+
    +#+
    +# 1. Here's what you need to add to protect a resource,+
    +# e.g. <ApacheServerRoot>/htdocs/private:+
    +#+
    +# <Location /private>+
    +# require valid-user+
    +# AuthType Osso+
    +# </Location>+
    +*<Location /forms/frmservlet>*+
    +*require valid-user*+
    +*AuthType Osso*+
    +*</Location>*+
    +</IfModule>+
    +#+
    +# If you would like to have short hostnames redirected to+
    +# fully qualified hostnames to allow clients that need+
    +# authentication via mod_osso to be able to enter short+
    +# hostnames into their browsers uncomment out the following+
    +# lines+
    +#+
    +#PerlModule Apache::ShortHostnameRedirect+
    +#PerlHeaderParserHandler Apache::ShortHostnameRedirect+

    Karthik,
    I think (to be confimed) that the Forms Servlet relies on Oracle SSO only (in order to get full SSO features and LDAP authentication).
    This OOTB feature deals with authentication but also with provisioning considerations and with passing context between Forms and Report (perhaps it's not in yours needs)
    Meanwhile, it should be possible to do a bind directly with the OID directory, from a Forms application.
    That means that you give up the SSO setup, and you implement the authentication into the application code with a specific login trigger.
    This trigger (on-logon) will call a PL/SQL function aimed to do a simple bind with the OID (just to verify the right combination user/password).
    Have a look into the Forms forum. There are numerous skilled guys who have probably already done this job.
    Fortunatly, OID is provided with a rich set of PL/SQL APIs at the database server level, well suited for Forms developers. You can also use LDAP APIs at the Apps Server level (vs Database).
    Patrick.

  • I want hide userid/pass when run forms app...

    i use sql*forms3.0 -_-;;;;
    i want hide userid/pass when run froms program.
    ex1) runforms30 fromname ( id/pass )
    ex2) runrep reportname ( id/pass )
    everyone show id/pass when this typing.
    "ps -ef | grep forms"
    Does someone knows if it is possible ?
    Thanks

    Though I did not use forms 3.0, you can try using on-logon trigger (if it exists in 3.0)
    At on-logon trigger write logon('username@connectstring', 'password'). Then mentioning (id/pass) is not required with runforms30. Check it out!

  • User Defined Login Screen

    Hi All
    I Am New To Forms . when ever i run my form i have to connect to data base sepecifying user name,password and host string.now at form level i have written a form level trigger(on logon)and mentioned it null;
    so now my form is not connecting to data base.now i have created a form giving username,password,hoststring as item types in my form. so when ever i run i want my form to be opend and through that i want to connect to data base.
    so how to give that connection?
    thanks in advance
    Sasi

    Hi
    I am not using forms web
    i have created a form which resembles the default logon screen provided by forms 6i.but how to write coding such that i can connect to my scott/tiger user.
    thanks in advance
    sasi

  • Access to Oracle Database by a specific user from a client system.

    Hi All,
    I need to restrict a particular client system to access the database only by a specific user credentials. I mean system A(hostname) can only connect the database PQR only and only by user U123. Any help is sincerely appreciated.
    Regards
    Swapan

    Hi,
    I solved it by a trigger at logon on V$SESSION which validates MACHINE like [HOSTNAME] and username not like [the_user_I_would_allow].
    It works now.
    Thanks for your reply.
    Regards
    Swapan

Maybe you are looking for

  • Optimizing more than one photo at a time for captivate?

    I'm creating half hour training modules that use roughly 100 slides with more than 100 photos/images during the 100 slides. The file works just fine but the IT department would like the download time to be quicker (was set to 75% downloaded to view a

  • Using an external hard drive with iTunes...

    My library has gotten so large that it really no longer fits on my computer. I'd like to move my music to an external hard drive. Unfortunately, I didnt realize the whole, "your music can only be moved 5 times before its frozen" deal until recently,

  • Cost center-attributes

    Plz just give the explanation about or any configuration settings COST CENTER ATTRIBUTES AND CONFIGURED THE ACTIVITY TYPES,

  • Reports with all functionality (sorting,total,subtotal,download)

    Hi, We require that all the actions which we can perform on the Reports available in SAP environment should also be available in the EP Platform. Eg        sorting,total,subtotal,download. Thanks.

  • How to find Namespaces used.

    hi guys, My customer is using Namespaces in ABAP development. but not sure where and whats the name of it. How can i find custom developed objects are used in Customer namespace in ABAP. Any specific transaction or table used for saving Namespaces..?