I have created a user called SPUSER and assigned them to a group that has select permissions on all the database tables. When running a select * from mytable, the query returns results as expected.
When SPUSER executes a stored procedure using mytable, it returns the following message:
An error occurred during implicit system action type "5".
Information returned for the error includes SQLCODE "-551", SQLSTATE "42501" and
message tokens "SPUSER|SELECT|MYSCHEMA.MYTABLE".. SQLCODE=-727, SQLSTATE=56098,
DRIVER=4.16.53
If I grant select privileges directly to the user then I don't get the error for that table anymore although I am getting the same error for a different table. I'm not sure whether I need to grant select privileges for all tables or whether only some are affected. The stored procedure has ran before successfully so not sure why I'm only seeing this now.
Does anyone know what causes this error and what I can do to fix it?
Thanks for any help.
Privileges granted to groups do not apply in a static context, e.g. stored procedures. You either have to grant the required privileges to the individual user or create a role (if your DB2 version supports roles), grant privileges to the role, then grant the role to the user.