Solved

Setting Application Context in Oracle for RLS

Posted on 2011-09-15
3
343 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 74

Accepted Solution

by:
sdstuber earned 500 total points
ID: 36548963
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
ID: 36552765
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 74

Expert Comment

by:sdstuber
ID: 36552833
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.
Suggested Courses

617 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