SQL Exception
In this chapter you will learn:
Exceptions in JDBC
java.sql.SQLException
extends the java.lang.Exception
class.
java.sql.SQLException
is a core JDBC exception class that
provides information about database access errors and other
errors. Most of the JDBC API methods throw SQLException.
java.sql.BatchUpdateException
is an Exception
that provides
the update counts for all commands that were executed successfully
during the batch update.
java.sql.DataTruncation
reports a Data Truncation warning
(on reads) or throws a DataTruncation
exception (on writes)
when JDBC unexpectedly truncates a data value.
java.sql.SQLWarning
provides information about database access warnings.
java.sql.SQLException Methods
Return Type | Method | Description |
---|---|---|
int | getErrorCode() | Retrieves the vendor-specific exception code for this SQLException object |
SQLException | getNextException() | Retrieves the exception chained to this SQLException object |
String | getSQLState() | Retrieves the SQLState for this SQLException object |
void | setNextException(SQLException ex) | Adds a SQLException object to the end of the chain |
Next chapter...
What you will learn in the next chapter:
- Extracting Information from SQLException
- Get the Details of a SQLException
- Print the stack trace for a SQLException to STDERR
Home » Java Tutorial » Statements, ResultSet, Exception, Warning