473,836 Members | 2,305 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Select privilage on all the tables in a schema.

Any Suggestions on the below scenario will be helpful to us.

# There are 10 tables in a schema “S1” and I have to give select
privilege (Only read access) to a user on all the tables in the schema
“S1”.

# Initially I have given the required privileges to the user with
grant command on every table..

# But the problem here is whenever there are new tables building in
the schema “S1”, We have to give the privilege Explicitly.

# It is okay if we have less number of tables and the changes are not
frequent, But our case is the tables are changing and there are
hundreds of it.

# Is there any way we to automate whenever a new table is created in
that schema the select privilege should go to user .
Thanks
-Kamal.
Jun 27 '08 #1
3 3236
On Apr 25, 9:02 pm, Gladiator <vkamalnath1... @gmail.comwrote :
Any Suggestions on the below scenario will be helpful to us.

# There are 10 tables in a schema “S1” and I have to give select
privilege (Only read access) to a user on all the tables in the schema
“S1”.

# Initially I have given the required privileges to the user with
grant command on every table..

# But the problem here is whenever there are new tables building in
the schema “S1”, We have to give the privilege Explicitly.

# It is okay if we have less number of tables and the changes are not
frequent, But our case is the tables are changing and there are
hundreds of it.

# Is there any way we to automate whenever a new table is created in
that schema the select privilege should go to user .

Thanks
-Kamal.
AFAIK it is not possible (but it would be great if someone proved me
wrong :-). I solved the problem with a script that loops over all the
tables in a given schema and grant select on each one to a user

/Lennart
Jun 27 '08 #2
Lennart wrote:
On Apr 25, 9:02 pm, Gladiator <vkamalnath1... @gmail.comwrote :
>Any Suggestions on the below scenario will be helpful to us.

# There are 10 tables in a schema “S1†and I have to give select
privilege (Only read access) to a user on all the tables in the schema
“S1â€.

# Initially I have given the required privileges to the user with
grant command on every table..

# But the problem here is whenever there are new tables building in
the schema “S1â€, We have to give the privilege Explicitly.

# It is okay if we have less number of tables and the changes are not
frequent, But our case is the tables are changing and there are
hundreds of it.

# Is there any way we to automate whenever a new table is created in
that schema the select privilege should go to user .

AFAIK it is not possible (but it would be great if someone proved me
wrong :-). I solved the problem with a script that loops over all the
tables in a given schema and grant select on each one to a user
Another alternative would be to implement an ACL-like table where each entry
in marks the access of a specific user or group to the table (or schema).
Then you create a view over each table and join with the ACL-table in the
view definition. You grant SELECT privileges to PUBLIC on each view and
the view definition takes care of the rest.

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Jun 27 '08 #3
On Apr 28, 11:04*pm, Knut Stolze <sto...@de.ibm. comwrote:
Lennart wrote:
On Apr 25, 9:02 pm, Gladiator <vkamalnath1... @gmail.comwrote :
Any Suggestions on the below scenario will be helpful to us.
# There are 10 tables in a schema “S1” and *I have to give select
privilege (Only read access) to a user on all the tables in the schema
“S1”.
# Initially I have given the required privileges to the user with
grant command on every table..
# *But the problem here is whenever there are new tables building in
the schema “S1”, We have to give the privilege Explicitly.
# It is okay if we have less number of tables and *the changes are not
frequent, But our case is the tables are changing and there are
hundreds *of it.
# Is there any way we to automate whenever a new table is created in
that schema the select privilege should go to user .
AFAIK it is not possible (but it would be great if someone proved me
wrong :-). I solved the problem with a script that loops over all the
tables in a given schema and grant select on each one to a user

Another alternative would be to implement an ACL-like table where each entry
in marks the access of a specific user or group to the table (or schema).
Then you create a view over each table and join with the ACL-table in the
view definition. *You grant SELECT privileges to PUBLIC on each view and
the view definition takes care of the rest.

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany- Hide quoted text -

- Show quoted text -
Hi Knut,
Even i am facing the same scenarios .,, can you please explain the
solution in more details ..

Thanks,
Kanhaiya
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2411
by: Mike | last post by:
Hello, I'm trying to understand how to map hierarchical XML data to relational database tables, but I seem to be missing something. I'm not a database expert, but I know the basics. XML seems so much more intuitive to me, though. Anyway, let me make up an example: Say we have an address book, in XML format, that is to be uploaded by a customer and then mapped into relational database tables. I would start by creating an XML Schema...
10
5643
by: serge | last post by:
Using "SELECT * " is a bad practice even when using a VIEW instead of a table? I have some stored procedures that are identical with the difference of one statement in the WHERE clause. If I create a single View and specify also in this View the WHERE clause that is common in these stored procedures, I will have the new stored procecures changed to be like:
1
15424
by: zeus | last post by:
Hi there, I am using Postgresql 7.3 and I want to grant select rights to a user on all tables in a schema, including those that may be created in the future but whose names are not yet known. I want to do something like: GRANT SELECT ON <schema>.* TO <user>; but select isn't a valid privilege on a schema and I don't see how wildcards are supported. Is there a way to do this, or does a table need to exist before a user can be granted...
19
2947
by: Shwetabh | last post by:
Hi, I have two tables: Code and Color. The create command for them is : create table Color( Partnum varchar(10), Eng_Color char(10), Span_Color char(20), Frch_Color char(20), CONSTRAINT pkPartnum PRIMARY KEY(Partnum)
11
3952
by: MurdockSE | last post by:
Greetings. My Situation: // I have an .xml file that I am reading into a dataset in the following code - DataSet ds = new DataSet("MyDataset"); ds.ReadXml(@"c:\data\"+cmyxmlfilename);
2
4697
by: Henrik | last post by:
Hi, I'm really stuck with this one. I have a dataset with two tables. One table is company data, and the other is contacts. I populate these by using a SP in SQL Server which returns the two tables in one call. I'm using Microsoft EnterpriseLibrary for Data to get the data from SP. It works fine and I get two tables in the dataset, "Table1" and "Table2". I then have an XML-file, which will serve as a template to generate the XML-schema,...
4
7206
by: Chris | last post by:
Can't seem to figure out how to do this and have been reading for some time now...... I want to select a row count from a table name in SYSTABLES. This statement does not return what I needed, but can help explain what I'm looking for. I want the results to be the Row Count from a Table Name out of the Sub-Select. Select Count(*) from
4
1670
by: tshad | last post by:
How do I tell DataAdapter that Column 2 and 3 are string and not integer? Following is the example data that comes from the .csv file FEDERAL TAX,1084,0000 COREHCR,1084,0000 CLIENT P,1084,0000 The select is: Dim da2 As New OleDb.OleDbDataAdapter("Select * from " &
4
3513
by: dkirkdrei | last post by:
I am having a problem getting results back from a SELECT statement using the script below. The field names contain decimals and I am not sure wether or not this is causing the problem or not?? I am connecting to a SQL server db using ODBC, first time connecting to SQL server but have been using ODBC to connect to Access db's for years. I have entered the field names just as they are in the table and I have tried replacing the spaces and...
0
9656
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10821
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10527
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10571
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10241
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6973
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5812
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4441
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3102
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.