How To Handle JDBC Exceptions In Database Resources


show more Handling JDBC exceptions provides you with in-depth training on Developer. Taught by David Gassner as part of the Java Database Integration with JDBC show less
please wait ...

Handling JDBC exceptions

Just as with all Java programming, when something goes wrong in JDBC, you'll get an exception. In JDBC, most methods of JDBC objects throw a class called SQLException. SQLException is extended from the Exception class, and it inherits all of the tools that are a part of that class, such as getMessage and getLocalizedMessage, string representations of an error message, getStackTrace, and many other tools. But JDBC is all about databases, and so its special exception class SQLException is specifically designed to give you information about what's going on in the database.

SQLException adds these methods, getErrorCode returns an integer value which tells you what might have gone wrong. The Error code is unique to the particular database, so a numeric error code for MySQL won't be the same as for HSQLDB, and so on. And there's also a method called getSQLState which returns a five-character string. It's just like the error code. It's specific to the particular vendor and the par...

Handling JDBC exceptions
Video duration: 7m 7s 2h 51m Intermediate

Viewers:

Handling JDBC exceptions provides you with in-depth training on Developer. Taught by David Gassner as part of the Java Database Integration with JDBC

Subject:
Developer
Software:
Java
Author:
please wait ...