Can I use dbms_session.set_role within AE?

I am augmenting an existing application with AE. The existing security scheme validates the user, then enables a role (with password) that has been granted update privs for all of the tables in the system. My AE application uses database authentication so users are uniquely identified in the database (no user or password appears in the DAD entry). When I try to duplicate the security functionality in AE, I get "ORA-06565: cannot execute SET ROLE from within stored procedure". Is there a way to accomplish this?
Secondly, even without enabling the role, the application seems to work even though it should not. When using the same user to connect thru Toad, updates are not allowed. Modifications made thru the application use the "user" psuedocolumn and the user is identified correctly (not HTMLDB_PUBLIC_USER) and the user is not set in AE as a user or developer.
I'm confused.
Bob

Bob,
No, the set_role won't work within stored procedures.
The privileges required to update your tables are owned by the schema itself. This schema is your application's parsing schema and is the schema that all SQL and PL/SQL in your application is parsed as.
To control access to data based on the authenticated user (user or sys_context('userenv','session_user'), you can use the VPD feature.
Scott

Similar Messages

  • How can i use connection pool within the sqlj?

    hello
    i am a beginner to sqlj,i find all of the sample code from the oracle DON'T use connectionpool,they only write the database url to "connection.properties" file,but i think in the production environment we should use the connectionpool to optimise the querying,i usually use the weblogic connection pool.
    how can i use the connection pool within the sqlj?
    thank you very much!

    Im not sure if I understand. :)
    English is not my best language...
    Looking up the connection again? Do you mean I have to create new DataSource object and bind it again to ServletContext?

  • Can I use "Smart Fix" within Organizer?

    I have just purchased PSE 13 and I can't see where you can use "Smart Fix" within Organizer? Does this mean you must go to Editor to use Smart Fix?

    Under the "Media" view you should have a button for instant fix (bottom right)

  • Can I use SimpleFdkCredential() from within a servlet?

    I have a test program that logs in to content DB using SimpleFdkCredential, and works perfectly well run from the main() method of a Java class from within JDeveloper. When I try to login the same way from within the doGet() method of a servlet, doGet() hangs on the call to ManagersFactory.login() using the same SimpleFdkCredential that works in-process. The login() call doesn't throw any exceptions, it just sits there waiting[I presume], and never returns.
    Is it necessary to use S2SFdkCredential for any authentication that originates from a servlet invocation? It seems that SimpleFdkCredential should work in this instance as well.
    Thanks.

    Can you check the Content DB http node log (application.log) with debug log level set, to see if the request from the servlet for the RemoteLoginManager Web Service was received?
    I would also check that all libraries are present/accessible from servlet - and that there are no conflicts with existing libraries.
    Also, check the servlet log for anything strange.
    Finally, you could try remote debugging of your servlet .. e.g -Xdebug java option.
    -Matt.

  • How can I use data merge, within a master, within a book?

    Hi all,
    I am producing an 84pp catalogue for multiple brands.
    I have it set up as:
    1x .indd document per spread
    Master styles within one .indd document for black text, white text etc.
    Book setup to contain all of the .indd files to make up the 84pp book
    Now, my problem is I have to change the footer text and references depending on the brand, so I can have the footers saying 'Call Brand A on 123 4567' or 'Call Brand B on 567 1234' and have various in-text references change from Brand A to Brand B and vice versa.
    I have a data merge on each of the masters in my .indd style source looking at a simple .csv of:
    Brand Name
    URL
    Phone Number
    Brand A
    www.branda.com
    0800 123 4567
    Brand B
    www.brandb.com
    0800 567 1234
    This works fine on the masters within the source .indd.
    But, when I close this master style source and go into another .indd document within the book (after synchronising) I see the <<Brand Name>> container but, when I export the documents it does not populate the book with the data - it keeps the containers.
    Obviously with a normal in-document Data Merge you'd click 'Create Merged Document' but I don't want to export each page, and I have PDF print presets / .joboptions file with settings for the book.
    Any advice on how to get this to work?
    Thanks!
    Andy

    I'm not really following the workflow here, but this seems like it might be better suited to Conditional Text than to Data Merge.

  • Can I use bpws:getVariableData() within oraext:format-string() ?

    I have problem in using the following expression in my "Assign" activity:
    oraext:format-string('|{0}|',bpws:getVariableData('inputVariable','payload','/client:process/client:name_param))
    I get the following error
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Header/><env:Body><env:Fault><faultcode>env:Server</faultcode><faultstring>XPath expression failed to execute.
    An error occurs while processing the XPath expression; the expression is oraext:format-string(‘|{0}|',bpws:getVariableData('inputVariable','payload','/client:process/client: name_param')).
    The XPath expression failed to execute; the reason was: internal xpath error.
    Check the detailed root cause described in the exception message text and verify that the XPath query is correct.
    </faultstring><faultactor/><detail><exception/></detail></env:Fault></env:Body></env:Envelope>
    Strangely, I can use the following expressions:
    1. concat('|', bpws:getVariableData('inputVariable','payload','/client:process/client:name_param))
    2. oraext:format-string('|{0}|', 'A value')
    Hence, it seemed to me that oraext:format-string() can't take the return value of bpmw:getVariableData() for some unknown reason.
    As I need to use the "format-string" function to create a complicated value based on a number of input values , I need to find a way to work around this.
    Otherwise, I am force to use the "concat" function which make it extra ugly to build the value I need.
    Please help!

    You need to wrap each parameter with striing().
    Something like this: oraext:format-string(*string*($inputVariable.payload/client:inputBase), string($inputVariable.payload/client:inputVal0))
    This way the oraext:format-string will work fine from bpel assign activity as well.
    Racheli.

  • Can't use mouse scroll within forms

    Hello,
    I have been working with SCSM 2012 since the public beta was released and I don't know why I haven't noticed this until my analysts said something but the mouse scroll wheel doesn't work within any of the forms. 
    It will scroll if you put the cursor directly over the vertical scroll bar but if the mouse is within the form its self it doesn't work.
    This is one of the most basic functionalities, is there any way to get that to work? 
    What is it about how the form is designed that doesn't allow the scrolling?
    I would be surprised if this is the first post anyone has made about this so if it's a duplicate I apologize.
    Thanks,
    Dustin

    Hi Dustin,
    I can confirm this bug, though if remember correctly, it only applies to some forms, not all. It's been reported on connect already, but please go vote on it:
    https://connect.microsoft.com/SC/feedback/details/753389/scrolling-with-mouse-wheel-in-throughout-the-system-is-inconsistent#tabs
    Regards
    //Anders
    Anders Asp | Lumagate | www.lumagate.com | Sweden | My blog: www.scsm.se

  • Can we use SELECT statement within IF..?

    DECLARE
    A NUMBER;
    BEGIN
    IF (SELECT '2' FROM DUAL) = 2 THEN
    A := 2;
    END IF;
    DBMS_OUTPUT.PUT_LINE(A);
    END;

    Did you tried to execute it. The error itself is an explanation
    ORA-06550: line 5, column 5:
    PLS-00103: Encountered the symbol "SELECT" when expecting one of the following:
    ( - + case mod new not null <an identifier>
    <a double-quoted delimited-identifier> <a bind variable>
    continue avg count current exists max min prior sql stddev
    sum variance execute forall merge time timestamp interval
    date <a string literal with character set specification>
    <a number> <a single-quoted SQL string> pipe
    <an alternatively-quoted string literal with character set specification>
    <an alternat
    ORA-06550: line 5, column 27:
    PLS-00103: Encountered the symbol "=" when expecting one of the following:
    ) , and orNo, we can not
    You can have expressions in IF statement but not a query. Instead, you can capture in a variable and then compare in IF
    declare
    a number;
    begin
    select 2 into a from dual;
    if a = 2 then
    dbms_output.put_line(1);
    end if;
    end;
    /

  • How can I use MS Word within java programming

    Hi everyone!
    I am developing a Java program that will take data
    from an Access 2000 database, and manipulate it,
    display the results graphically and in tables. The
    challenge for me is that I want the program insert the
    graphics and tables into the MS Word template and then
    prompt me to save it as a word * .doc. Do you know
    of any articles or sources of sample code on how to do
    this. The Java environment is Java2, JDK 1.3,
    JBuilder4. The OS environment is XP.
    Regards,
    Farad

    Hi, I also need that package. my e-mail is [email protected] Plese send me that. Thanks in advance
    I have a package that will do this for you. I just
    need to get your email to send an attachment and
    examples.

  • DBMS_SESSION.SET_ROLE in Forms 6

    I created a role called "DATA_ENTRY" and altered it so that the DEFAULT_ROLE property set to "NO".
    I have an application with a customized menu that uses roles in menu security. The role is in the list of menu roles. The application has multiple forms, only one of which is open at a time, with a Main form as the point of entry. Navigation is implemented only through the menu.
    I added code to the PRE-FORM trigger that uses DBMS_SESSION.SET_ROLE to enable the role. With the code in place, the screen opens and the menu is enabled. If I comment out the code, the Menu fails when I open the Main form - which is what I'd expect.
    However, when I navigate to another screen, it acts like the Main form does with the code commented out - i.e., the Menu fails (doesn't load).
    Since DBMS_SESSION.SET_ROLE is a session-level command, I wouldn't think I'd have to include it in every screen.
    I'd appreciate any help. Thanks.

    Could it be that you are opening your other screen in SESSION_MODE=SESSION ?The forms are opened using New_Form builtin, so the SESSION_MODE doesn't apply.
    In the post-form trigger of the main screen, the role that I enable in the pre-form trigger is shown as disabled. So, of
    course, it's disabled in the new screen as well.
    I also verified that the UNIQUE_SESSION_ID is the same in pre-form and post_form on both screens.

  • Using 2 refcursors within the same procedure

    Hi,
    Can we use 2 refcursors within the same procedure. This might sound strange. But I have a scenario of doing so- one for dynamically checking for some validations and another for returning a result set.

    Yes, go thru the below example.
    CREATE OR REPLACE PACKAGE CURSPKG AS
    TYPE T_CURSOR IS REF CURSOR;
    PROCEDURE OPEN_TWO_CURSORS (EMPCURSOR OUT T_CURSOR,
    DEPTCURSOR OUT T_CURSOR);
    END CURSPKG;
    CREATE OR REPLACE PACKAGE BODY CURSPKG AS
    PROCEDURE OPEN_TWO_CURSORS (EMPCURSOR OUT T_CURSOR,
    DEPTCURSOR OUT T_CURSOR)
    IS
    V_CURSOR1 T_CURSOR;
    V_CURSOR2 T_CURSOR;
    BEGIN
    OPEN V_CURSOR1 FOR SELECT * FROM EMP;
    OPEN V_CURSOR2 FOR SELECT * FROM DEPT;
    EMPCURSOR := V_CURSOR1;
    DEPTCURSOR := V_CURSOR2;
    END OPEN_TWO_CURSORS;
    END CURSPKG;
    I hope it would be helpful.

  • How can I use SQL to search for a pattern within a field?

    Hello, Frank, Solomon, ect
    I am now faced with this particular scenario, I've got the SQL to search through a field to find text within the field, but I have to know what it is before it can look for it.
    What I have to do is this:
    Search through a field, for a pattern, and I won't know what the data is I am looking for. Can this be done in SQL?
    For instance, Here is my SQL this far, I was helped allot in order to get to this point.
    select table_name,
           column_name,
           :search_string search_string,
           result
      from (select column_name,
                   table_name,
                   'ora:view("' || table_name || '")/ROW/' || column_name || '[ora:contains(text(),"%' || :search_string || '%") > 0]' str
              from cols
             where table_name in ('TABLE1', 'TABLE2')),
           xmltable (str columns result varchar2(10) path '.')
    When you execute the above SQL, you have to pass in a value. What I really need is to alter the above SQL, to make it search for a pattern that exist's within the text of the field itself.
    Like for instance, lets say the pattern I am looking for is this" xx-xxxxx-xxxx" and it's somewhere in a field.
    I need to alter this SQL to take this pattern and search through all the schemas and tables to look for this pattern match.
    Can be done?

    When you use something dynamically within a function or procedure, roles do not apply and privileges must be granted directly.  So, you need to grant select on dba_tab_cols directly.  If you want to do pattern matching then you should use regular expressions.  The following example grants the proper privileges and uses regexp_instr to find all values containing the pattern xxx-xxxx-xxxx, where /S is used for any non-space character.  I limited the tables in order to save time and output for the test, but you can eliminate that where clause.
    SYS@orcl> CREATE USER test IDENTIFIED BY test
      2  /
    User created.
    SYS@orcl> ALTER USER test QUOTA UNLIMITED ON USERS
      2  /
    User altered.
    SYS@orcl> GRANT CREATE SESSION, CREATE TABLE TO test
      2  /
    Grant succeeded.
    SYS@orcl> GRANT SELECT ON dba_tab_cols TO test
      2  /
    Grant succeeded.
    SYS@orcl> CONNECT test/test
    Connected.
    TEST@orcl> SET LINESIZE 90
    TEST@orcl> CREATE TABLE table1
      2    (tab1_col1  VARCHAR2(60))
      3  /
    Table created.
    TEST@orcl> INSERT ALL
      2  INTO table1 (tab1_col1) VALUES ('xxx-xxxx-xxxx')
      3  INTO table1 (tab1_col1) VALUES ('matching abc-defg-hijk data')
      4  INTO table1 (tab1_col1) VALUES ('other data')
      5  SELECT * FROM DUAL
      6  /
    3 rows created.
    TEST@orcl> CREATE TABLE table2
      2    (tab2_col2  VARCHAR2(30))
      3  /
    Table created.
    TEST@orcl> INSERT ALL
      2  INTO table2 (tab2_col2) VALUES ('this BCD-EFGH-IJKL too')
      3  INTO table2 (tab2_col2) VALUES ('something else')
      4  SELECT * FROM DUAL
      5  /
    2 rows created.
    TEST@orcl> VAR search_string VARCHAR2(24)
    TEST@orcl> EXEC :search_string := '\S\S\S-\S\S\S\S-\S\S\S\S'
    PL/SQL procedure successfully completed.
    TEST@orcl> COLUMN "Searchword"     FORMAT A24
    TEST@orcl> COLUMN "Table"     FORMAT A6
    TEST@orcl> COLUMN "Column/Value" FORMAT A50
    TEST@orcl> SELECT DISTINCT SUBSTR (:search_string, 1, 24) "Searchword",
      2               SUBSTR (table_name, 1, 14) "Table",
      3               SUBSTR (t.column_value.getstringval (), 1, 50) "Column/Value"
      4  FROM   dba_tab_cols,
      5          TABLE
      6            (XMLSEQUENCE
      7           (DBMS_XMLGEN.GETXMLTYPE
      8              ( 'SELECT ' || column_name ||
      9               ' FROM ' || table_name ||
    10               ' WHERE REGEXP_INSTR
    11                     (UPPER (' || column_name || '),''' ||
    12                  UPPER (:search_string) || ''') > 0'
    13              ).extract ('ROWSET/ROW/*'))) t
    14  WHERE  table_name IN ('TABLE1', 'TABLE2')
    15  ORDER  BY "Table"
    16  /
    Searchword               Table  Column/Value
    \S\S\S-\S\S\S\S-\S\S\S\S TABLE1 <TAB1_COL1>matching abc-defg-hijk data</TAB1_COL1>
    \S\S\S-\S\S\S\S-\S\S\S\S TABLE1 <TAB1_COL1>xxx-xxxx-xxxx</TAB1_COL1>
    \S\S\S-\S\S\S\S-\S\S\S\S TABLE2 <TAB2_COL2>this BCD-EFGH-IJKL too</TAB2_COL2>
    3 rows selected.

  • Can we share music/apps within a family while using different iTunes accounts?

    Can we share music/apps within a family while using different iTunes accounts?
    Recently purchased iPhone 5 for my wife and I + my daugther has an iPod.  I'd like for us all to have separate iTunes accounts so we can each use iCloud without getting each other's notifications, but would like to have one central repository for mucsic and apps.  I'm afraid if I set up iTunes accoutn for the tow of them, I'll have to re-purchase the music and apps (way too many!)

    It can be done, but you will have to sign in to your account on her itunes to updated the apps. Try these instructions:
    http://support.apple.com/kb/HT1848

  • Help with Adobe.premiere.elements12. Please It would appear under the organizer tab that the photos are organised in the lowest folder in the folder structure within Windows Explorer.  How can I use the Windows Explorer structure to organise the photos wi

    Help with Adobe.premiere.elements12. Please
    It would appear under the organizer tab that the photos are organised in the lowest folder in the folder structure within Windows Explorer.  How can I use the Windows Explorer structure to organise the photos within Elements.

    In a situation such as yours, I tend to consolidate items into folders so I have folders of nice workable numbers of images, somewhere between 20 and 200 images. Now, whatever, once you've imported, do your moving within LR, not the OS! I will select all in a folder and drag into a folder a level or two or three above, and then delete the newly empty subfolders. I hope this helps a bit!
    Once you've reached just new Imports of camera output, you'll be flying along.

  • Within itunes, can I use the file/library/export library option to transfer itunes to a new pc

    Within itunes, can I use the file/library/export library option to transfer itunes to a new pc? I have read the other options but they will be difficult for me to action. Can this be used as an easier route?

    No. See this migrate iTunes library post.
    tt2

Maybe you are looking for