-
Website
http://awads.net/wp/ -
Original page
http://awads.net/wp/2005/08/05/sys_context-in-oracle/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
jgarry
3 comments · 1 points
-
Andy C
22 comments · 47 points
-
dahowlett
1 comment · 2 points
-
Don Seiler
9 comments · 1 points
-
davidhaimes
4 comments · 3 points
-
-
Popular Threads
We're on the same page. I discovered this handy thing around the same time:
http://thinkoracle.blogspot.com/2005/07/which-i...
Very handy!
Execellent ... It is veryful for me.
Hi All
I have a database on which users can execute queries. To ensure they cant view each others information I want to execute this query first:
dbms_session.set_context('usernameParam', 'username', username);
I then want to create views that look like this:
CREATE OR REPLACE VIEW "MyView" AS SELECT * FROM "DB"."MyTable"
WHERE "Username" = SYS_CONTEXT('usernameParam', 'username')
/
I then want my clients to use the views instead of tables.
I am doing this using Java. I get a database connection. Using that connection I execute the set_context query. I am wandering, how thread safe is this? If 2 clients at the same time execute a query is it possible that the set_context will be execute in the wrong order and clients see each others information or does the set_context apply only to the current connection even thought the same username is used to connect to the database?