How to get a field's value with ResultSet.getxxx when it is a NULL?

Joe Sam Shirah

You should not get an error/exception just because of null values in various columns. This sounds like a driver specific problem and you should first check the original and any chained exceptions to determine if another problem exists.

In general, one may retrieve one of three values for a column that is null, depending on the data type. For methods that return objects, null will be returned; for numerics ( get Byte(), getShort(), getInt(), getLong(), getFloat(), and getDouble() ) zero will be returned; for getBoolean() false will be returned. To find out if the value was actually NULL, use ResultSet.wasNull() before invoking another getXXX method. For more information, see the JDBC(tm) Technology Guide: Getting Started 5.1.19 NULL Result Values.