Search code examples
db2publicprivileges

How to revoke privileges from a public user in db2?


Hi am trying to revoke the privileges of public users to create tables in my sample database.

Iam inserting this statement:

db2 revoke createtab on sample from public

While running this, the Database issues a problem.

C:\Users\Administrator\Documents>db2 revoke Createtab on sample from public
DB21034E  The command was processed as an SQL statement because it was not a
valid Command Line Processor command.  During SQL processing it returned:
SQL0204N  "ADMINISTRATOR.SAMPLE" is an undefined name.  SQLSTATE=42704

I have created the database and I am also logged in as administrator.

I don't know where my problem is...


Solution

  • The correct syntax is:

    REVOKE CREATETAB ON DATABASE FROM PUBLIC

    That is, you must not use the database name instead of the DATABASE keyword.