You can use methods of java.lang.Throwable to view the message issued by a SQL exception, including the SQLState and error messages.
Alternatively, you can use the getSQLState and getMessage
methods to view the SQLState and error messages, and you can use
getErrorCode to see the error code. The error code defines the severity
of the error and is not unique to each exception.
Applications should also check for and process java.sql.SQLWarnings,
which are processed in a similar way.