Enable Oracle Role with OLE-DB?

  • I need to enable a role with OLE-DB in C++. I guess it would be a general SQL statement so I presume I would be using CCommand.

    The SQL statement would be

    set role myrole identified by myroleID

    Anybody have an example?

  • CREATE ROLE NEWROLE NOT IDENTIFIED

    ;

    GRANT NEWROLE TO USERACCOUNT

    ;

    ALTER USER USERACCOUNT DEFAULT ROLE NEWROLE,

    OTHER_ROLES_GRANTED

    ;

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
  • Thank you Paul.

    I don't need to create a role, only enable one, and I believe this can be done with the connection string, with the arguments ROLENAME and ROLEPWD.

    I was looking in the wrong place.

  • Apparently setting the role in the connect string isn't enough. The session is openrf without error, but when I try to open a recordset in which the role is required I get a DB_E_NOTABLE error.

  • I agree with Randy

    air Jordans escort shanghai China tour CHINESE FOOD

  • I tried putting garbage in for the ROLENAME and ROLEPWD and the connection opened with S_OK. HUH?

  • In the Oracle world roles are usually granted once to an specific user so that user account will inherit all privileges associated with the role each time it logs in into the system.

    In short, you create the user account, you grant the role then the application doesn't have to worry about it anymore.

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
  • make sure you don't set a password when you create the role. otherwise it will promte all the user who ever is using this role to enter the password for the role id.

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply