Access other schema to check details

I am updating certain rows (contain coupons information) in the db with a particular condition
Before updaing i need to check whether those are in active status in an other schema which has relevant info related to coupons
do i need nested am's to do this

hi,
you can use createStatement() method of AM to get any data from the database (if AM's user has db privileges to read another users tables)
here is an example:
http://jjzheng.blogspot.com/2010/11/run-single-query-in-application-module.html
regards,
Brano

Similar Messages

  • Access other schema's table without specify the schema name

    Hi, need ur help again,
    I would like to access other schema's table without specify the schema name. for example,
    select * from hr.jobs;
    What priviledges i need if i want to select the data in this way:
    select * from jobs;
    Thanks!

    Public synonyms have their place, but are not generally a good idea as they will cause conflicts with other schemas and applications. Another think that you can do is issue the
    ALTER SESSION set CURRENT_SCHEMA = schema;
    The CURRENT_SCHEMA (8i and above) parameter changes the current schema of the session to the specified schema. Subsequent nqualified references to schema objects during the session will resolve to objects in the specified schema. The setting persists for the duration of the session or until you issue another ALTER SESSION SET CURRENT_SCHEMA statement. CURRENT_SCHEMA is a session parameter only, not an initialization parameter.
    This setting offers a convenient way to perform operations on objects in a schema other than that of the current user without having to qualify the objects with the schema name. This setting changes the current schema, but it does not change the session user or the current user, nor does it give you any additional system or object privileges for the session.

  • Access other schema object from connection

    Hi;
    from the dbconnection, how can I access other schema object?
    Thanks

    Hi,
    I don't know if I understand correctly but if you mean the scenario you connect to the database as SCOTT and you want to map table EMPLOYEES from HR schema, you can do it within wizard and in read only view object you
    use schema name as prefix like select * from HR.EMPLOYEES. If you mean something else please describe it more.
    regards,
    Branislav

  • Readonly user can access other schema and change them

    Hello everybody,
    I created a readonly user like this in oracle 11g r2
    SQL> CREATE USER readonly IDENTIFIED BY readonly;
    SQL> GRANT CREATE SESSION ,CREATE SYNONYM TO readonly;
    SQL> GRANT SELECT ON SA.vCustomerService TO readonly;
    But when I connect to the database and do a select like:
    SQL> SELECT * FROM ACC;
    I get the data from that table, even if I do an update on that table it works.
    What am I doing wrong that my readonly user still has full acces on the other schema?
    Thanks in advance for your help!
    Best regards,
    GIL GOMES Dany

    Dan_lu wrote:
    Hello everybody,
    I created a readonly user like this in oracle 11g r2
    SQL> CREATE USER readonly IDENTIFIED BY readonly;
    SQL> GRANT CREATE SESSION ,CREATE SYNONYM TO readonly;
    SQL> GRANT SELECT ON SA.vCustomerService TO readonly;
    But when I connect to the database and do a select like:
    SQL> SELECT * FROM ACC;
    I get the data from that table, even if I do an update on that table it works.Check the permissions for that table -- maybe some operations on this table are granted to publc?

  • Oracle 11G, access other schema's procedure

    Hi all,
    I have a peculiar problem while calling a procedure from JAVA.
    I have two schemas, SCH1 and SCH2. Java is connected to  SCH1. There is a procedure in SCH2, grant is given to SCH1. in SCH1 a synonym is created using the following commad.
    create synonym PR_GET_DATE for sch2.PR_GET_DATE;
    Procedure is given below. For testing, I removed all the actions inside my procedure.
    create or replace
    PROCEDURE PR_GET_DATE(
        P_REP_PROCESS_DATE IN DATE,
        P_REP_TYPE         IN VARCHAR2,
        P_ETL_DATE OUT DATE ,
        P_STATUS OUT VARCHAR2,
        P_MSG OUT VARCHAR2)
    AS
      V_WK_REP_DATE DATE;
    BEGIN
    null;
    end;
    {code}
    If I test this from SQLPLUS, it works fine. But if I call it from Java, I am getting the following error in Java. But if I compile it in SCH1 and try calling from java, it works fine. Can someone please explain me the possible cause of this behaviour.
    org.springframework.jdbc.BadSqlGrammarException:
    CallableStatementCallback; bad SQL grammar [{call PR_CLMSR_GET_REP_DATE()}];
    nested exception is java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types
    of arguments in call to 'PR_CLMSR_GET_REP_DATE'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Thanks,
    Jaggyam

    Thanks All for you response!
    Grant is given, otherwise it would have been clearly mentioned in the error
    We are passing all the parameters with appropriate value. To throw more light on that, we did not make any change in the java. But simply dropped the synonym took the copy of the procedure from SCH2 and compiled in SCH1. After doing so, I didn't get any error in Java. So nothing wrong in the number of parameters passed or their type.
    By looking at the error message, even I thought the parameters are not properly passed from java. But without making any code change Java, it is working fine after we moved the procedure to SCH1. Again in either case when I called from SQLPLUS, I had no issues. I don't have a concrete evidence to put in front of my Java team to prove that nothing is wrong in the code.
    Kindly throw your thoughts please.
    Thanks in advance,
    Jaggyam

  • Restricted view access to other schemas 'showstopper' problem

    I'm tasked with the potential roll-out of SQL Developer across a large number of users (doing away with equivalent software in the process).
    The feedback has been very positive. However, the only real issue stopping the replacement from progressing is that we cannot view certain objects in other schemas (package bodies, triggers etc) ... i.e. we need to connect as the schema owner to view these. This is essential, otherwise everyone would need to know the application schemas password.
    Our current software has the same issue unless the following option in the Options/Startup window is activated: 'Check for access to DBA views. Otherwise, SYS.ALL_xx views will be used when listing objects'. Thereafter the issue is resolved.
    Is there any workaround (e.g. like the above) in SQL Developer?
    Many Thanks.

    Sue, thanks for your reply although I already have access to Package code via tools like SQL*Plus.
    I guess the problem being discussed here is similar to the following thread (for which you have already logged a bug). See:
    How do I view package bodies in another schema ?
    Re: How do I view package bodies in another schema ?
    On a similar issue, I note that there is a possibility that a fix will indeed be implemented in release 1.1. See:
    Package body not visible
    Re: Package body not visible
    Please advise what the current status is relating to a fix?
    Many thanks for any clarification.

  • EWS API - Impersonating to update a calendar item created by any other user than a service account, raise an error "Access is denied. Check credentials and try again."

    Hi,
    I am new to using EWS managed APIs.
    Following is the issue:
    1. I am using a service account e.g. [email protected]. This user is a global administrator and also has ApplicationImpersonation role assigned. (Sign into Online Office 365 account -> Admin -> select "Exchange" tab- > select Permissions
    on the left panel -> create an impersonation role -> assign ApplicationImpersonation in Roles: and [email protected] in Members: -> Click on save)
    2. Create a calendar item by other user for e.g. [email protected], and invite an attendee - [email protected].
    3. In a c# program, I connect to EWS service using a service account - [email protected], fetch its calendar events. If organizer of an event is some other user - [email protected] then
    I use impersonation in the following way to update the calendar event/item properties- subject, body text etc.
            private static void Impersonate(string organizer)
                string impersonatedUserSMTPAddress = organizer;
                ImpersonatedUserId impersonatedUserId =
                    new ImpersonatedUserId(ConnectingIdType.SmtpAddress, impersonatedUserSMTPAddress);
                service.ImpersonatedUserId = impersonatedUserId;
    4. It was working fine till yesterday afternoon. Suddenly, it started throwing an exception "Access is denied. Check credentials and try again." Whenever I try to
    update that event.
           private static void FindAndUpdate(ExchangeService service)
                CalendarView cv = new CalendarView(DateTime.Now, DateTime.Now.AddDays(30));
                cv.MaxItemsReturned = 25;
                try
                    FindItemsResults<Item> masterResults = service.FindItems(WellKnownFolderName.Calendar, cv);
                    foreach (Appointment item in masterResults.Items)
                        if (item is Appointment)
                            Appointment masterItem = item as Appointment;
                            if (!masterRecurEventIDs.Contains(masterItem.ICalUid.ToString()))
                                masterItem.Load();
                                if (!masterItem.Subject.Contains(" (Updated content)"))
                                    //impersonate organizer to update and save for further use
                                    Impersonate(masterItem.Organizer.Address.ToString());
                                    // Update the subject and body
                                    masterItem.Subject = masterItem.Subject + " (Updated content)";
                                    string currentBodyType = masterItem.Body.BodyType.ToString();
                                    masterItem.Body = masterItem.Body.Text + "\nUpdated Body Info:
    xxxxxxxxxxxx";
                                    // This results in an UpdateItem operation call to EWS.
                                    masterItem.Update(ConflictResolutionMode.AutoResolve);
                                    // Send updated notification to organizer of an appointment
                                    CreateAndSendEmail(masterItem.Organizer.Address.ToString(), masterItem.Subject);
                                    masterRecurEventIDs.Add(masterItem.ICalUid.ToString());
                                else
                                    Console.WriteLine("Event is already updated. No need to update again.:\r\n");
                                    Console.WriteLine("Subject: " + masterItem.Subject);
                                    Console.WriteLine("Description: " + masterItem.Body.Text);
                catch (Exception ex)
                    Console.WriteLine("Error: " + ex.Message);
    5. What could be an issue here? Initially I thought may be its a throttling policy which is stopping same user after making certain API call limits for the day, but I am still seeing this issue today.
    Any help is appreciated.
    Thanks

    Your logic doesn't sound correct here eg
    2. Create a calendar item by other user for e.g. [email protected], and invite an attendee - [email protected]
    3. In a c# program, I connect to EWS service using a service account - [email protected], fetch its calendar events. If organizer of an event is some other user - [email protected] then
    I use impersonation in the following way to update the calendar event/item properties- subject, body text etc.
    When your connecting to [email protected] mailbox the only user that can make changes to items within
    abccalendar is abc (or ABC's delegates). If your impersonating the Organizer of the appointment pqr that wouldn't work unless the organizer had rights to abc's calendar. If you want to make updates to a calendar
    appointment like that you should connect to the Organizers mailbox first update the original, send updates and then accept the updates.
    When you impersonate your impersonating the security context of the Mailbox your impersonating so its the same a logging on as that user in OWA or Outlook.
    Cheers
    Glen

  • How does Apex access and manage db objects in other schemas?

    I'm looking for a description of how Apex accesses and manages database objects in other schemas.
    I'm sure I've seen such a description somewhere earlier but am unable to find it again...

    Hi Rene,
    When you are connected to sqlworkshop, it is basically connected to the sceham owner of the workspace. If you execute the query
    select sys_context( 'userenv', 'current_schema' ), user,  username from user_users;you would see the schema and user(currently connected) and schema owner through which you have logged in. The user will have all the privileges granted to schema owner. So basically you get connected through APEX_PUBLIC_USER and it has all the privileges of the schema owner.
    In order to run scripts in another schema you would need grants on other schema same like you are connected to user A through sqlplus and wants to create objects in schema B. For example lets say you want to create a table in schema B and you have create table privileges in scehma B , you can execute command create table B.emp as select * from A.emp;
    I hope this answers your question.
    Regards,
    Manish

  • Queue available in one schema want to access through other schema

    Hi All,
    There is one queue available in apps schema. I want to access the queue from other schema. Can anyone provide me the steps.
    Regards

    select * from schema_name.table_name;
    *you must have sufficient privileges to see this scheme                                                                                                                                                                                               

  • Is there a way to access object from other schema?

    1. Is there a way to access object from other schema
    Without using synonym/public synonym without prefixing schema owner?
    2. If you do not see any object in all_objects by same name owned by connected user or public, can there still be objects hidden from this view? for instance synonyms created by SYSTEM
    TIA for help

    Well, you missed something somewhere. If there is no
    ALTER SESSION SET CURRENT_SCHEMA=whoeverthen there must be either public synonym for the object as this shows:
    SQL> CREATE USER a identified by a;
    User created.
    SQL> GRANT CREATE SESSION to a;
    Grant succeeded.
    SQL> CREATE USER b identified by b;
    User created.
    SQL> GRANT CREATE SESSION, CREATE PROCEDURE, CREATE PUBLIC SYNONYM to b;
    Grant succeeded.
    SQL> connect b/b
    Connected.
    SQL> CREATE PACKAGE test AS
      2     PROCEDURE testit;
      3  END;
      4  /
    Package created.
    SQL> CREATE PACKAGE BODY test AS
      2  PROCEDURE testit IS
      3  BEGIN
      4     NULL;
      5  END;
      6  END;
      7  /
    Package body created.
    SQL> connect a/a
    Connected.
    SQL> desc b.test
    ERROR:
    ORA-04043: object b.test does not exist
    SQL> connect b/b
    Connected.
    SQL> GRANT EXECUTE ON test TO a;
    Grant succeeded.
    SQL> connect a/a
    Connected.
    SQL> desc b.test;
    PROCEDURE TESTIT
    SQL> desc test;
    ERROR:
    ORA-04043: object test does not exist
    SQL> connect b/b
    Connected.
    SQL> CREATE PUBLIC SYNONYM test FOR TEST;
    Synonym created.
    SQL> connect a/a
    Connected.
    SQL> desc test
    PROCEDURE TESTITAnother possibility without public synonyms is that crv had granted the other user privileges on some object, and the other user creates a private synonym for that. When crv granted privileges on a different object with the same name, the private synonym became valid again. Something like:
    SQL> connect /
    Connected.
    SQL> drop public synonym test;
    Synonym dropped.
    SQL> GRANT CREATE SYNONYM TO a;
    Grant succeeded.
    SQL> connect a/a
    Connected.
    SQL> desc test;
    ERROR:
    ORA-04043: object test does not exist
    SQL> desc b.test
    PROCEDURE TESTIT
    SQL> CREATE SYNONYM test FOR b.test;
    Synonym created.
    SQL> desc test;
    PROCEDURE TESTIT
    SQL> connect b/b
    Connected.
    SQL> REVOKE EXECUTE ON test FROM a;
    Revoke succeeded.
    SQL> connect a/a
    Connected.
    SQL> desc test;
    ERROR:
    ORA-04043: object "B"."TEST" does not exist
    SQL> desc b.test
    ERROR:
    ORA-04043: object b.test does not exist
    SQL> connect b/b
    Connected.
    SQL> DROP PACKAGE test;
    Package dropped.
    SQL> CREATE FUNCTION test (p_num IN NUMBER) RETURN NUMBER AS
      2  BEGIN
      3     RETURN p_num * 10;
      4  END;
      5  /
    Function created.
    SQL> GRANT EXECUTE ON test TO a;
    Grant succeeded.
    SQL> connect a/a
    Connected.
    SQL> desc test;
    FUNCTION test RETURNS NUMBER
    Argument Name                  Type                    In/Out Default?
    P_NUM                          NUMBER                  INSo, I would go looking for the synonyms.
    TTFN
    John

  • Grant access to all object/tables in other schemas to a user

    Is there any and simple way to grant access to all object/tables in other schemas (more than one) to a scheme/user?
    Thanks.
    Tarman.

    HI.
    grant SELECT ANY TABLE,delete any table, insert any table to user; Giving this delete,insert ANY TABLE privilege to a user can be dangerous and the use can mislead it. Its better to create a dynamic script and then grant it.
    E.g Suppose you want to give select,inert,delete,update privileges to user A on user B's object.
    sql> spool grants.sql
    sql> select 'grant select,insert,update,delete on '||owner||'.'||table_name||' to A;' from dba_tables where owner='B';
    sql>@grants.sqlHTH
    Anand

  • Query in Stored Procedure accessing another schema

    Hi - this is going to sound kind of strange and even i can't come up with an explanation. My JDK 1.1.7 applet uses a type 4 JDBC thin driver (i think v 8.04.06) to access an Oracle 7.3.4 database. We also have a link with full grants and synonymns to another Oracle schema in an Oracle 8 database. Has never been a problem - we can access anything we need to through queries or stored procedures from either of these databases.
    So, i have a new stored procedure that needs to be called through JDBC that queries a table in the Oracle 8 database. For some reason, whenever i execute this stored procedure from java it hangs on this query and the instance needs to be restarted. If i execute that same stored procedure from SQL Plus, it runs fine.
    I tried a little test. I put a straight query in my java code that goes directly to that table (no stored procedure involved). It runs great through java!
    is this weird or what? my dbas have checked out all privelages and it seems that i have access to everything i could possibly need.
    If anyone has any suggestions i would love to hear them.
    thanks for your help...
    Lori - [email protected]
    null

    You can only access an object in another user's schema if you either:
    (a) Specify the 'other' schema name explicitly: SCHEMA.OBJECT
    (b) A synonymn has been created to access the object: CREATE SYNONYM OBJECT FOR SCHEMA.OBJECT.
    The user requiring the synonym should create it, or the user owning the object can create a PUBLIC synonym, if they have the authority.
    To check my hypothesis, try typing 'DESCRIBE procedure_name' from SQL*Plus as both users.

  • SQL Develeoper 1.5.5 - Synonyms in other schemas missing in tree view-BUG?

    Hi!
    I have upgraded to the latest version of SQL Developer 1.5.5. When I look in other schemas the synonyms are not displayed. Normally I am logged into an account with DBA privileges. Other objects appear to display correctly. I was not able to find this listed as a known bug. Has anyone else had this problem? Is there anything that can be done to correct it? This is a big problem for us at the moment.
    Thanks for any help, ideas, suggestions, etc.! Let me know if there is any other information I can provide.
    Dave Venus

    What do you mean by synonyms in other schemas ?
    When I look in another schema (through Other Users), the Synonyms node is filled correctly.
    Public synonyms are accessed through your own connection, in the node with the same name.
    You'll have to be more detailed as to what is failing, preferably with a reproducible example.
    K.

  • Inconsistent logic for viewing others schemes objects in browser

    A while ago when we upgraded our db's to Oracle 10 we also replaced our famous green friend for Sql Developer with our entire development crew.
    Among a few other things, people were not all that happy, seeing that they lost the desired "check for access to dba views option". But as long as we could rely on a consistent view in the "other schema" in all possible views (via table, or directly in the navigator) we could defend this way of thinking for not being able to see everything.
    But unfortunately, in the latest version "1.5.1 5440", we still see inconsistent things...
    for example :
    via browser (other users schema)
    => Indexes are not visible in the indexes branch point, but they do show up on the indexes tab for the corresponding table.
    => For the same "other users scheme", Triggers do show up in the triggers branch point, but then when we check the trigger tab for the corresponding table, they are not shown
    It looks like waiting for yet another version is no option and we will be forced to retreat to the green commercial swamp on high demand of our developers...
    Ribbit :-(

    There are still a few glitches in the queries used for certain things - I cannot remember the problem you mention with indexes being posted before (although I get the same problem with indexes visible in all_indexes not appearing on other users index node), but the trigger tab problem has been discussed before (1.5PROD/EA3/EA2/EA1: Only table owners triggers show in Table's trigger tab
    theFurryOne

  • Unable to see other schemas in JDeveloper Connections Navigator

    When I add a database to my Connections Navigator, only one Schema is visible under the DB. I am unable to view other schemas to which the user has access.
    How do I view the other schemas?

    Yes.. Thats missing in 10.1.3.0.4(bug 5027141)
    Check forum: Cant view objects from another schemas

Maybe you are looking for