If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > unusual user error running stored procedure

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-03-09, 10:50
davebert99 davebert99 is offline
Registered User
 
Join Date: Jun 2009
Location: Pennsylvania
Posts: 21
unusual user error running stored procedure

I'm running DB2 9.1.5 on the Z/os. I'm getting an unusual user privilege error running a stored procedure created as one user and run as another. Basically it goes like this:

* log in as USER111
* create procedure MAIN.PROC1 { procedure updates table MAIN.TABLE }
* log in as USER222
* call MAIN.PROC1()
SQL0551N "USER111" does not have the privilege to perform operation "UPDATE" on object "MAIN.TABLE". SQLSTATE=42501

This is correct. USER111 does not have update privileges, but USER222 does and that is who is logged in and running the procedure. Any idea on why I am getting this error?
Reply With Quote
  #2 (permalink)  
Old 09-03-09, 11:26
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
I might be wrong with respect to Z/OS, but I think this is exactly the expected behaviour. The SP package runs with the authorization ID that was used to bind it. You could try rebinding the package as user222 before running the SP.
Reply With Quote
  #3 (permalink)  
Old 09-03-09, 12:02
Stealth_DBA Stealth_DBA is offline
Registered User
 
Join Date: May 2009
Posts: 472
davebert99, I think you just need to grant USER222 Execute authorization on the Stored Procedure. I have also seen some places that USER222 might need Execute authorization on the Package but I have had mixed results (most of the time I do NOT grant to the Package and the Stored Procedure can be executed with no problem.
Reply With Quote
  #4 (permalink)  
Old 09-03-09, 12:23
davebert99 davebert99 is offline
Registered User
 
Join Date: Jun 2009
Location: Pennsylvania
Posts: 21
Thanks all. I'll research those suggestions.

USER222 must already have Execute or they couldn't run the procedure to get that error. They would get:
SQL0551N "USER222" does not have the privilege to perform operation "CALL" on object "MAIN.PROC1".

Dave
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On