Results 1 to 10 of 10
  1. #1
    Join Date
    Mar 2008
    Posts
    136

    Unanswered: select privilages

    Hi,
    I want to give select persmissons to perticular user or anyone can select only except one main user.

    What are the steps?

    Regards
    Pawan
    Regards
    Pawan Kumar

  2. #2
    Join Date
    Apr 2008
    Location
    Iasi, Romania
    Posts
    561
    Provided Answers: 2
    to grant select privileges on a table to a single user, you will use:
    GRANT SELECT ON TABLE table_name TO USER user_name

    to grant this permission to everyone but a single user, you must create a group in which you will include everyone (except that user) and you will use:
    GRANT SELECT ON TABLE table_name TO GROUP group_name

  3. #3
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    1,126
    Quote Originally Posted by Pawan Kumar
    I want to give select permissons to particular user
    GRANT SELECT ON TABLE tablename1, tablename2, viewname3, ... TO user-id ;
    Quote Originally Posted by Pawan Kumar
    or anyone can select only except one main user.
    GRANT SELECT ON TABLE tablename1, tablename2, viewname3, ... TO PUBLIC ;
    GRANT ALL ON TABLE tablename, ... TO main-user ;
    (Or make sure that main-user is the table owner, who always has ALL privileges.)
    --_Peter Vanroose,
    __IBM Certified Database Administrator, DB2 9 for z/OS
    __IBM Certified Application Developer
    __ABIS Training and Consulting
    __http://www.abis.be/

  4. #4
    Join Date
    Mar 2008
    Posts
    136
    thanks....

    If i create a new user C on linux server...
    and on this server there are running two instances A and B with users A and B respectively....I want to access databases of A and B by user C and want to give select privilages to C user for databases running under A and B.

    how can we do this?
    Regards
    Pawan Kumar

  5. #5
    Join Date
    Apr 2008
    Location
    Iasi, Romania
    Posts
    561
    Provided Answers: 2
    On each database:
    GRANT CONNECT ON DATABASE TO USER C

    and then use the grants above

  6. #6
    Join Date
    Mar 2008
    Posts
    136
    I logged in by User A and gave grant permissiong to user B..
    su - A
    first asking for database connection...
    db2 connect to A
    then i did
    db2 GRANT CONNECT ON DATABASE TO USER B
    DB20000I The SQL command completed successfully.

    now login by User B
    su - B
    and try to connect database A but througing below
    db2 connect to A user A using **
    SQL1013N The database alias name or database name "A" could not be found.
    SQLSTATE=42705


    what I need to do?
    Regards
    Pawan Kumar

  7. #7
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by Pawan Kumar

    what I need to do?
    CATALOG DATABASE A ...
    ---
    "It does not work" is not a valid problem statement.

  8. #8
    Join Date
    Mar 2008
    Posts
    136
    by cataloging my requirement is not being full...
    Regards
    Pawan Kumar

  9. #9
    Join Date
    May 2007
    Location
    somewhere in dbforums
    Posts
    221
    Quote Originally Posted by Pawan Kumar
    I logged in by User A and gave grant permissiong to user B..
    su - A
    first asking for database connection...
    db2 connect to A
    then i did
    db2 GRANT CONNECT ON DATABASE TO USER B
    DB20000I The SQL command completed successfully.

    now login by User B
    su - B
    and try to connect database A but througing below
    db2 connect to A user A using **
    SQL1013N The database alias name or database name "A" could not be found.
    SQLSTATE=42705


    what I need to do?
    In this specific scenario you have to follow the following steps

    first do
    su - A
    first asking for database connection...
    db2 connect to A
    then i did
    db2 GRANT CONNECT ON DATABASE TO USER B
    DB20000I The SQL command completed successfully.

    then get details of instance for database A

    then do
    su - B

    now you'll have to catalog the instance A using the following command
    db2 catalog tcpip node <<nodename>> remote <<db2server ip>> server <<pot of node>>

    now do 'db2 list node directory' and check whether the node has been cataloged

    now you'll have to catalog the database

    db2 catalog db <<dbname>> as alias <<alias-name>> at node <<nodename>>

    where nodename is the same as the node that is specified while cataloging the node
    [ points to note - database alias name cannot be same as an existing alias name or a db name ]

    now do 'db2 list db directory' and check whether the database A details is displayed

    now do
    connect to A user <<username>> using <<password>>
    [ in this case use the alias name that you have specified for database A ]

  10. #10
    Join Date
    Mar 2008
    Posts
    136
    thanks to all
    Regards
    Pawan Kumar

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •