MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Grant insert access to DB2 table via Rexx script

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
misi01
Advanced


Joined: 02 Dec 2002
Posts: 629
Topics: 176
Location: Stockholm, Sweden

PostPosted: Thu Aug 14, 2014 9:07 am    Post subject: Grant insert access to DB2 table via Rexx script Reply with quote

Is it possible to define DB2 grant on a table such that it's okay to run a Rexx script that inserts into a table but at the same time, not allow users to select/view the table (in the same way IMS can allow a specific MQ queue to start ONE specific IMS transaction)????
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Aug 14, 2014 11:51 am    Post subject: Reply with quote

misi01,

Do you want ALL your users to able to insert using a REXX script but they cannot see what they insert?

or is it just 1 person who wants to insert? and no one else can see the contents of the table?

Eitherway you can Code the GRANT statement in rexx and execute it with a commit

Code:

GU_ST = 'GRANT INSERT ON TABLE mytable to userid;'
RUNSTMT = 'EXECUTE IMMEDIATE :GU_ST'
ADDRESS DSNREXX "EXECSQL" RUNSTMT

....

repeat the above with a COMMIT statement

Now perform the Insert

At the end revoke the insert authority

REV_ST = 'REVOKE INSERT ON TABLE mytable FROM userid;'
RUNSTMT = 'EXECUTE IMMEDIATE :REV_ST'
ADDRESS DSNREXX "EXECSQL" RUNSTMT

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
misi01
Advanced


Joined: 02 Dec 2002
Posts: 629
Topics: 176
Location: Stockholm, Sweden

PostPosted: Thu Sep 04, 2014 12:31 am    Post subject: Reply with quote

I wanted all users to be able insert into the table but not to be able to access it in any other way.

Unfortunately, your suggestion (although simple) didn't cut it. Turned out (no idea why) I had to apply to our security department so they could set up the RACF authority.
After that. the Rexx script simply had top perform the actual insert, nothing else.
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Sep 04, 2014 10:26 am    Post subject: Reply with quote

misi01 wrote:
Unfortunately, your suggestion (although simple) didn't cut it. Turned out (no idea why) I had to apply to our security department so they could set up the RACF authority.
After that. the Rexx script simply had top perform the actual insert, nothing else.


Well You need to have GRANTEE authority to grant other users insert ability. If you don't have it , it will obviously fail. You should have checked the SQL CODE after the grant statement which would tell you the exact reason for the failure.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
misi01
Advanced


Joined: 02 Dec 2002
Posts: 629
Topics: 176
Location: Stockholm, Sweden

PostPosted: Thu Sep 04, 2014 12:22 pm    Post subject: Reply with quote

The problem wasn't the grant (as far as I could see). I had a colleague testing it and he kept getting a RACF error on access to myuser.usage.insert (where usage was the name of the table and obviously insert was what the rexx code was trying to do)
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group