Join David Gassner for an in-depth discussion in this video Handling JDBC exceptions, part of Java Database Integration with JDBC.
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 particular database, but it's a string instead of an integer.…
Author David Gassner explains how to choose a JDBC driver and connect to one or more databases. He also provides detailed instructions on reading, selecting, and updating data; calling stored procedures; managing data via JavaBean classes or with prepared statements; and working with metadata.
- Importing a MySQL database
- Connecting to databases
- Handling JDBC exceptions
- Looping through result sets
- Limiting the number of fetched rows
- Filtering data with prepared statements
- Calling stored procedures
- Inserting, updating, and deleting rows with prepared statements
- Using a persistent database connection
- Committing and rolling back transactions
Skill Level Intermediate
1. Installing Software
2. Getting Started with JDBC
3. Managing Database Resources
Handling JDBC exceptions7m 7s
4. Reading Data
5. Managing Data
6. Using Metadata
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.