Return Codes
The SQL-92
standard defines a set of
SQLSTATE
return codes. SQLSTATE
is defined as a five-character string, where the leftmost two
characters define the error class, and the remaining three characters
define the error subclass. Some database vendors may extend these
return codes; classes beginning with the numbers 5 through 9 and
letters I through Z are reserved for such implementation-specific
extensions. The SQLSTATE
code for
a particular JDBC action can be retrieved via the
getSQLState( )
method of
SQLException
. Table 12-3 lists the
SQLSTATE
return codes defined in SQL-92.
Table 12-3. SQL-92 SQLSTATE Return Codes
Class |
Class Definition |
Subclass |
Subclass Definition |
---|---|---|---|
|
Successful completion |
|
None |
|
Warning |
|
None |
|
Cursor operation conflict | ||
|
Disconnect error | ||
|
Null value eliminated in set function | ||
|
String data, right truncation | ||
|
Insufficient item descriptor areas | ||
|
Privilege not revoked | ||
|
Privilege not granted | ||
|
Implicit zero-bit padding | ||
|
Search expression too long for information schema | ||
|
Query expression too long for information schema | ||
|
No data |
|
None |
|
Dynamic SQL error |
|
None |
|
Using clause doesn’t match dynamic parameters | ||
|
Using clause doesn’t match target specifications | ||
|
Cursor specification can’t be executed | ||
|
Using clause required for dynamic parameters | ||
|
Prepared statement not a ... |
Get Java Enterprise in a Nutshell, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.