Db2 – Hows to make a DB2 table read-only

db2

We need to test how an application will fail when the DB2 database cannot be written to.

What is the easiest way to make a DB2 table read-only? Is this considered locking?

Thanks in advance,
Bert

Best Answer

There are a couple of ways to test it:

  • Use LOCK TABLE and put it in "exclusive" mode
  • REVOKE the privilege to INSERT or UPDATE on that table from the test user
  • REVOKE the privilege to connect to that database
  • Change or remove TCP/IP access to the database
  • ...

There are many testing scenarios and most of them will result in a different error message.