Solved

Setting Application Context in Oracle for RLS

Posted on 2011-09-15
3
326 Views
Last Modified: 2012-05-12
Dear All,
I have a requirement.
I have web Based Oracle Application (Oracle Forms 10gAs and Oracle 10g DB).
There are approx. 800 application userid but only one DB User .
All application userid is maintained in a table (say T_USER_MASTER).
Each application Userids is associated with one user role or more (stored in T_USER_ROLE).
I want to restrict one column(Col1) of a table (say T1) for all application userid other than one who is doctor (Role).

I want to do this through RLS but I do not know where ,when & how to set system context for this.
Pls.let me know the steps to be followed.
0
Comment
Question by:surendra_oracle
  • 2
3 Comments
 
LVL 73

Accepted Solution

by:
sdstuber earned 500 total points
Comment Utility
contexts are set using a procedure or package.  you define that object when you create the context

for instance...


CREATE OR REPLACE CONTEXT my_context USING context_test_pkg;  

CREATE OR REPLACE PACKAGE context_test_pkg
AS
    PROCEDURE set_context;
END;

CREATE OR REPLACE PACKAGE BODY context_test_pkg
AS
    PROCEDURE set_context
    IS
    BEGIN
            DBMS_SESSION.set_context('my_context',
                                    'some_name',
                                    'some_value'
                                    );

             DBMS_SESSION.set_context('my_context',
                                    'some_other_name',
                                    'some_other_value'
                                    );
    END;
END;
0
 

Author Comment

by:surendra_oracle
Comment Utility
Thanks.
I do not understand "you define that object when you create the context for instance...".
When and where to set context in D2K Application.
Pls. give me some real example (as I have mentioned in my question)
0
 
LVL 73

Expert Comment

by:sdstuber
Comment Utility
usually you set a context at the beginning of a session.

in a web application where you might have a connection pool, you might want to set the context per page.
I can't be more specific than that because the answer depends on your specific application operation
basic rule:  before you access an object you want context controlled- set the context, if you set it more than once, it's inefficient, but not dangerous


>> I do not understand "you define that object when you create the context for instance...".

CREATE OR REPLACE CONTEXT my_context USING context_test_pkg;  

the object "context_test_pkg"  is defined for the context "my_context"

this means you can only set "my_context" by using "context_test_pkg"
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now