How can we handle SQL exception in Java?

How can we handle SQL exception in Java?

SQL Exception is associated with a failure of a SQL statement. This exception can be handled like an ordinary exception in a catch block.

Example:
catch(SQLException sqle)
{
    // code to handle this exception
}
The statement
Import java.sql.SQLException;
Should be given in the beginning of the corresponding .java file.

The classes used to handle the SQL exceptions are:
- ClassNotFoundException
- SQLException
What is DatabaseMetaData in Java?
DatabaseMetaData provides comprehensive information about the database...
What is ResultSetMetaData in Java?
ResultSetMetaData is a class which provides information about a result set that is returned by an executeQuery() method...
CacheRowset, JDBCRowset and WebRowset in Java.
A CacheRowSet object is a container for rows, that ‘caches’ the rows in the memory...
Post your comment