May 7, 2009 at 8:25 am
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?
May 7, 2009 at 9:16 am
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.May 7, 2009 at 9:23 am
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.
May 7, 2009 at 10:22 am
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.
May 7, 2009 at 8:22 pm
I agree with Randy
May 8, 2009 at 6:44 am
I tried putting garbage in for the ROLENAME and ROLEPWD and the connection opened with S_OK. HUH?
May 8, 2009 at 8:07 am
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.May 29, 2009 at 9:50 am
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