DB2 SQL Errors Codes and Error Messages and Warnings from Error -551 to -553

SQLServerF1

Error: DB2 SQL Error: SQLCODE=-551, SQLSTATE=42501, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
auth-id DOES NOT HAVE THE
PRIVILEGE TO PERFORM
OPERATION operation ON OBJECT
object-name
Explanation: Authorization ID auth-id attempted to
perform operation on object object-name without having
been granted the proper authority to do so. This error
might also occur if the object is a read-only view (for
insert, delete, or update data change operation), or if
auth-id is trying to create a table or view with an
authorization ID other than its own.
You can create a table from an auth-id other than your
own only if your authorization ID is SYSADM,
DBADM, or DBCTRL. You can create a view from an
auth-id other than your own only if your authorization
ID is SYSADM.
If you are using a trusted context, the token auth-id
might return a role instead of an authorization ID. A
role is returned if a role was in effect and the
authorization checking is performed against the role,
rather than the authorization ID of the session, when
the condition was encountered. Otherwise an
authorization ID is returned. A role is returned in the
following format as a single token:
v ROLE: role-name
In addition to the situations mentioned previously, this
error can occur for the following situations:
v When operation is GRANT ***, the keyword ALL was
used in the GRANT statement, but the grantor
auth-id does not have any privilege to grant.
v If operation is DROP PACKAGE, the object-name
consists of the collection ID, the package name, and
the consistency token. The consistency token
uniquely identifies the version of the package that
the user does not have authorization to drop.
v If operation is USAGE OF DISTINCT TYPE or USAGE
OF JAR, the object-name identifies, respectively, the
DISTINCT TYPE or JAR for which the auth-id lacks
USAGE privilege.
v If operation is ALTER JAR, the auth-id lacks ALTERIN
privilege on the schema of the JAR object-name.
v If this error occurs while DB2 is creating or altering a
table that involves referential constraints, this error
message reports that the user does not have the
necessary ALTER privilege to perform a FOREIGN
KEY, DROP FOREIGN KEY, DROP PRIMARY KEY,
or DROP UNIQUE operation. The object-name
identifies the object table of the CREATE or ALTER
TABLE statement, not the table for which the user
lacks the ALTER privilege.
v If this error occurs for a distributed SQL request, one
of the following conditions can occur:
– If authorization ID translation is in effect for either
the requesting DB2 site or the serving
(responding) DB2 site, then auth-id is the
translated authorization ID. Refer to Part 3
(Volume 1) of the DB2 Administration Guide for
information on authorization ID translation.
– If an alias name was used in the SQL statement,
the object-name is the resolved remote table name
or view name.
v If this error occurs during invocation of a routine,
the authorization ID auth-id does not have the
EXECUTE privilege on any candidate routine in the
SQL path. The variable for object-name is the name of
a candidate routine in the SQL path.
Note: Beginning with Version 5, SQLCODE -551 is
returned instead of SQLCODE -204 for the run-time
error in which an object does not exist and the
CURRENT RULES special register is set to STD.
System action: The statement cannot be executed.
Programmer response: To correct the error, verify the
following situations:
v The auth-id has the authority to perform the
operation.
v The object-name exists.
v The auth-id is not trying to create a table with a
schema qualifier that is not the same as auth-id.
SQLSTATE: 42501

Error: DB2 SQL Error: SQLCODE=-552, SQLSTATE=42502, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
authorization-id DOES NOT HAVE THE
PRIVILEGE TO PERFORM
OPERATION operation
Explanation: An operation was attempted by an
authorization ID that lacks the required authority.
authorization-id
The authorization ID that attempted to
perform the operation.
If you are using a trusted context, the
authorization-id value might be a role instead of
an authorization ID. A role is returned if a role
was in effect and the authorization checking is
performed against the role, rather than the
authorization ID of the session, when the
condition was encountered. Otherwise an
authorization ID is returned. A role is returned
in the following format as a single token:
ROLE: role-name DOES NOT HAVE THE
PRIVILEGE TO PERFORM OPERATION operation
operation
The operation that was attempted.
System action: The statement cannot be processed.
Administrator response: Check for an attempted
authorization violation.
Programmer response: Ensure that the authorization
ID has been granted the authority necessary to perform
the desired operation.
SQLSTATE: 42502

Error: DB2 SQL Error: SQLCODE=-553, SQLSTATE=42503, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
auth-id SPECIFIED IS NOT ONE OF
THE VALID AUTHORIZATION IDS
FOR REQUESTED OPERATION
Explanation: The statement failed for one of the
following reasons:
v The authorization ID specified as the value of the
authorization-id or host variable in the SQL SET
CURRENT SQLID statement is neither the user’s
primary authorization ID nor one of the associated
secondary authorization IDs.
v The authorization ID specified as the value of the
PACKAGE OWNER option for a CREATE or ALTER
PROCEDURE statement is neither the user’s primary
authorization ID nor one of the associated secondary
authorization IDs.
System action: The statement cannot be processed.
User response: Change the authorization ID to a value
that the user can use.
SQLSTATE: 42503

Above are list of DB2 SQL Errors and Warnings from Error -551 to -553 received while performing certain operation against DB2 Database or related products.

SQLCODE – Regardless of whether the application program provides an SQLCA or a stand-alone variable, SQLCODE is set by DB2 after each SQL statement is
executed. DB2 conforms to the ISO/ANSI SQL standard as follows:
If SQLCODE = 0, execution was successful.
If SQLCODE > 0, execution was successful with a warning.
If SQLCODE < 0, execution was not successful.
SQLCODE = 100, “no data” was found. For example, a FETCH statement returned no data because the cursor was positioned after the last row of the result table.

SQLSTATE – SQLSTATE is also set by DB2 after the execution of each SQL statement. Thus, application programs can check the execution of SQL statements by testing SQLSTATE instead of SQLCODE.

Hope this was helpful.

Thanks,
SQLServerF1 Team
Information about DB2 SQL Error Codes and Error Messages on Windows, Linux and Z/OS Operating Systems.

 

Leave a Reply

Your email address will not be published. Required fields are marked *