DB2 user table batch authorization _ PHP Tutorial

Source: Internet
Author: User
Tags db2 connect db2 connect to
Batch authorization of DB2 user tables. DB2 user table batch authorization 1. create a user [root @ localhost ~] # PasswdghanChangingpasswordforuserghan. NewUNIXpassword: BADPASSWORD: itistooshortRetypenewUNIXpasswo DB2 user table batch authorization

1. create a user
[Root @ localhost ~] # Passwd ghan
Changing password for user ghan.
New UNIX password:
Bad password: it is too short
Retype new UNIX password:
Passwd: all authentication tokens updated successfully.
[Root @ localhost ~] # Su-db2inst2
[Db2inst2 @ localhost ~] $ Db2 connect to ghan user ghan
Enter the current ghan password:


Database Connection information


Database server = DB2/LINUXX8664 9.7.5
SQL authorization id = GHAN
Local database alias = GHAN


II. access the db2int2. t2 table and report an error

[Db2inst2 @ localhost ~] $ Db2 "select count (1) from db2inst2. t2"
SQL0551N "GHAN" does not have operations on the object "DB2INST2. T2" SELECT"
Required permissions or privileges. SQLSTATE = 42501



[Db2inst2 @ localhost ~] $ Db2 connect to ghan


Database Connection information


Database server = DB2/LINUXX8664 9.7.5
SQL authorization id = DB2INST2
Local database alias = GHAN

3. generate authorization scripts
[Db2inst2 @ localhost ~] $ Db2-x + o-z commands. SQL "select 'grant select, insert, update, delete on table' | trim (tabschema) | '. '| trim (tabname) |' to user ghan; 'from syscat. tables where type ='t '"
4. modify table authorization
[Db2inst2 @ localhost ~] $ Vi commands. SQL

***

5. execute authorization statements
[Db2inst2 @ localhost ~] $ Db2-tsvf commands. SQL
Grant select, insert, update, delete on table DB2INST2. EMPL to user ghan
The DB20000I SQL command is successfully completed.


Grant select, insert, update, delete on table DB2INST2. EMPLDD to user ghan
The DB20000I SQL command is successfully completed.


Grant select, insert, update, delete on table DB2INST2. STAFF to user ghan
The DB20000I SQL command is successfully completed.


Grant select, insert, update, delete on table DB2INST2. T1 to user ghan
The DB20000I SQL command is successfully completed.



[Db2inst2 @ localhost ~] $ Db2 connect to ghan user ghan
Enter the current ghan password:


Database Connection information


Database server = DB2/LINUXX8664 9.7.5
SQL authorization id = GHAN
Local database alias = GHAN

VI. test authorization results

[Db2inst2 @ localhost ~] $ Db2 "select count (*) from db2inst2. t1"


1
-----------
4


1 record selected.

Principal 1. create a user [root @ localhost ~] # Passwd ghan Changing password for user ghan. New UNIX password: bad password: it is too short Retype new UNIX passwo...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.