Fix of reason code “7” SQLCODE=-668 SQLSTATE=57016

In DB2, you may face this error. This error means that the access to the table is restricted. Do not be worry if you see this error because it may happen after the ALTER TABLE DROP COLUMN statement.

In order to fix this error, you need to run the REORG command as follows:

REORG TABLE [YOUR_TABLE_NAME]

After running this command, you will be able to access the table.

For more information about the DB2 REORG command check:
http://publib.boulder.ibm.com/infocenter/db2e/v9r1/index.jsp?topic=%2Fcom.ibm.db2e.doc%2Fsqlreorgt.html

DB2 calling REORG command from JDBC

Sometimes, you need to run the DB2 REORG command from the JDBC code. You will need to run the REORG command usually after executing the ALTER TABLE DROP COLUMN statement. In order to execute the REORG command from JDBC, you can do this as follows:

Call Sysproc.admin_cmd ('reorg Table [YOUR_TABLE_NAME]');

I hope that this tip can be useful to you.