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 > grant schema objects for a user problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-06-04, 08:06
shedb shedb is offline
Registered User
 
Join Date: Dec 2003
Posts: 78
grant schema objects for a user problem

Hello,
I have a question about granting.
The db manager is DB2 v7

There is a user "X" on a database, and it creates tables X.table_t.
There is another user "Y" on this database.
What I want is that , whenever X creates a table on db, user Y can automatically have select/insert/update/delet rights on this table.

I'm now doing the grantings one by one for each table.But I don't want to follow the future tables.I want it to be done automaticallly.

I made the following grant:
"grant alterin on schema X to user Y"
but it did not work.
What can i do?
thanks all, have a nice day...
Reply With Quote
  #2 (permalink)  
Old 01-06-04, 18:05
nidm nidm is offline
Registered User
 
Join Date: May 2003
Posts: 113
Re: grant schema objects for a user problem

grant schema objects, will only work for stored procedures and user-defined functions, or specify a comment for distinct types, cast functions that are generated for distinct types, stored procedures, triggers, and user-defined functions in the designated schemas.

that stmt won't work for tables/views

Quote:
Originally posted by shedb
Hello,
I have a question about granting.
The db manager is DB2 v7

There is a user "X" on a database, and it creates tables X.table_t.
There is another user "Y" on this database.
What I want is that , whenever X creates a table on db, user Y can automatically have select/insert/update/delet rights on this table.

I'm now doing the grantings one by one for each table.But I don't want to follow the future tables.I want it to be done automaticallly.

I made the following grant:
"grant alterin on schema X to user Y"
but it did not work.
What can i do?
thanks all, have a nice day...
Reply With Quote
  #3 (permalink)  
Old 01-06-04, 18:09
nidm nidm is offline
Registered User
 
Join Date: May 2003
Posts: 113
Re: grant schema objects for a user problem

you many consider use stmt:
GRANT USE OF tablespace TO y
If you can ensure only X create tables in such tablespace.
Quote:
Originally posted by nidm
grant schema objects, will only work for stored procedures and user-defined functions, or specify a comment for distinct types, cast functions that are generated for distinct types, stored procedures, triggers, and user-defined functions in the designated schemas.

that stmt won't work for tables/views
Reply With Quote
  #4 (permalink)  
Old 01-07-04, 04:41
shedb shedb is offline
Registered User
 
Join Date: Dec 2003
Posts: 78
Question

thank a lot nidm,
what if y is not a very privileged user as x?
if y is only allowed to "select" the tables of x?
can anything be done in this case?
Reply With Quote
  #5 (permalink)  
Old 01-07-04, 12:53
nidm nidm is offline
Registered User
 
Join Date: May 2003
Posts: 113
sorry, I don't have any better idea. let's see whether some experieced
DBA may have.
Quote:
Originally posted by shedb
thank a lot nidm,
what if y is not a very privileged user as x?
if y is only allowed to "select" the tables of x?
can anything be done in this case?
Reply With Quote
  #6 (permalink)  
Old 01-08-04, 04:05
jsander jsander is offline
Registered User
 
Join Date: Apr 2003
Posts: 191
Hi shedb,

you have the option to share os users among x and y, i.e. give them the same login. To take this to extremes, you may want to develop/create your database tables with the same user that your application uses.

If this is not an option consider writing an application along these lines:

for each ( table = ( select tabschema . '.' . tabname from syscat.tables where type <> 'A' ) )
do
grant select, insert, update, delete on table to public
done

Generally, DB2 requires creators of tables and views to explicitly grant other users privileges.

Johann

Quote:
Originally posted by shedb
thank a lot nidm,
what if y is not a very privileged user as x?
if y is only allowed to "select" the tables of x?
can anything be done in this case?
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