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 > Privilege required to execute stored procedures

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-18-04, 10:22
pinecone pinecone is offline
Registered User
 
Join Date: Apr 2004
Posts: 58
Question Privilege required to execute stored procedures

We have problem executing stored procedures after granting EXECUTE to the application user. It is only after DBADM privilege is granted to the appl user the stored procedures can be executed successfully. Isn't this risky though?

Is DBADM privilege required in executing all stored procedures?
If so, is there any white paper available documenting this requirement?

Thanks in advance.
Reply With Quote
  #2 (permalink)  
Old 11-18-04, 11:31
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
You only need to grant EXECUTE on that procedure and, if it's not a java SP, also EXECUTE on the corresponding package.
Reply With Quote
  #3 (permalink)  
Old 11-18-04, 11:55
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
On DB2 8.1 FP4a for AIX, I have created a stored procedure (language SQL) and have only granted execute access on the procedure, without any execute authority on the package, and it works fine. The stored procedure is executed by a java application using a user authid which is not instance owner, dbadm, etc.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #4 (permalink)  
Old 11-18-04, 15:06
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Right, that's how it works in v8. Before that you had to grant EXECUTE rights for the package too.

By the way, pinecone: check that the user under whose authority the procedure runs has permissions to access and/or update the objects that are referenced in the procedure.
Reply With Quote
  #5 (permalink)  
Old 11-22-04, 07:49
Tank Tank is offline
Registered User
 
Join Date: Feb 2004
Location: Copenhagen
Posts: 220
Arrow Permissions

n_i

I'm curious about your last comment, I thought it was
sufficient to have execute privileges. In other words
you are saying that its not possible to run procedures
without having permissions on the underlying objects ?

- not very good for delegation
__________________
Kristian K. Hansen
Project Supervisor
National Board of Health
Reply With Quote
  #6 (permalink)  
Old 11-22-04, 10:09
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
I meant to say that the "definer" of an SP must have the rights to execute every statement in the procedure. I believe it's under definer's authority that the statements are executed at run time. So yes, you can "delegate" but to do that you'll need appropriate rights yourself.
Reply With Quote
  #7 (permalink)  
Old 11-22-04, 10:13
Tank Tank is offline
Registered User
 
Join Date: Feb 2004
Location: Copenhagen
Posts: 220
Smile

OK now I understand

Cheers
__________________
Kristian K. Hansen
Project Supervisor
National Board of Health
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